Esempio n. 1
0
int r3dTexture::Load( const char* fname, D3DFORMAT targetTexFormat, int downScale /*= 1*/, int downScaleMinDim /*= 1*/, int systemMem /*= 0*/ )
{
	sprintf(Location.FileName, "%s", fname);
	strlwr(&Location.FileName[0]);

	if( g_async_loading->GetInt() && R3D_IS_MAIN_THREAD() && g_pBackgroundTaskDispatcher)
	{
		r3dBackgroundTaskDispatcher::TaskDescriptor td ;

		TextureLoadTaskParams* params = g_TextureLoadTaskParams.Alloc() ;

		params->TargetTexFormat = targetTexFormat;
		params->DownScale		= downScale;
		params->DownScaleMinDim = downScaleMinDim;
		params->SystemMem		= systemMem ;

		params->Loadee			= this ;

		td.Params = params ;
		td.Fn = LoadTexture ;
		td.CompletionFlag	= 0 ;

		g_pBackgroundTaskDispatcher->AddTask( td ) ;
	}
	else
	{
		DoLoad( targetTexFormat, downScale, downScaleMinDim, systemMem ) ;
	}

	return 1 ;	
}
Esempio n. 2
0
void
FontFace::InitializeSource(const StringOrArrayBufferOrArrayBufferView& aSource)
{
  if (aSource.IsString()) {
    if (!ParseDescriptor(eCSSFontDesc_Src,
                         aSource.GetAsString(),
                         mDescriptors->mSrc)) {
      Reject(NS_ERROR_DOM_SYNTAX_ERR);

      SetStatus(FontFaceLoadStatus::Error);
      return;
    }

    mSourceType = eSourceType_URLs;
    return;
  }

  mSourceType = FontFace::eSourceType_Buffer;

  if (aSource.IsArrayBuffer()) {
    GetDataFrom(aSource.GetAsArrayBuffer(),
                mSourceBuffer, mSourceBufferLength);
  } else {
    MOZ_ASSERT(aSource.IsArrayBufferView());
    GetDataFrom(aSource.GetAsArrayBufferView(),
                mSourceBuffer, mSourceBufferLength);
  }

  SetStatus(FontFaceLoadStatus::Loading);
  DoLoad();
}
Esempio n. 3
0
File: wasap.c Progetto: 070499/xbmc
static void LoadAndPlay(int song)
{
	byte module[ASAP_MODULE_MAX];
	int module_len;
	int duration;
	if (!loadModule(current_filename, module, &module_len))
		return;
	if (songs > 0) {
		ClearSongsMenu();
		StopPlayback();
		songs = 0;
		EnableMenuItem(hTrayMenu, IDM_SAVE_WAV, MF_BYCOMMAND | MF_GRAYED);
	}
	if (!DoLoad(&asap, module, module_len))
		return;
	if (!WaveOut_Open(asap.module_info.channels)) {
		ShowError("Error initalizing WaveOut");
		return;
	}
	if (song < 0)
		song = asap.module_info.default_song;
	songs = asap.module_info.songs;
	EnableMenuItem(hTrayMenu, IDM_SAVE_WAV, MF_BYCOMMAND | MF_ENABLED);
	updateInfoDialog(current_filename, song);
	SetSongsMenu(songs);
	CheckMenuRadioItem(hSongMenu, 0, songs - 1, song, MF_BYPOSITION);
	current_song = song;
	duration = asap.module_info.durations[song];
	if (asap.module_info.loops[song])
		duration = -1;
	ASAP_PlaySong(&asap, song, duration);
	Tray_Modify(hPlayIcon);
	WaveOut_Start();
}
Esempio n. 4
0
Promise*
FontFace::Load(ErrorResult& aRv)
{
  mFontFaceSet->FlushUserFontSet();

  EnsurePromise();

  if (!mLoaded) {
    aRv.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }

  // Calling Load on a FontFace constructed with an ArrayBuffer data source,
  // or on one that is already loading (or has finished loading), has no
  // effect.
  if (mSourceType == eSourceType_Buffer ||
      mStatus != FontFaceLoadStatus::Unloaded) {
    return mLoaded;
  }

  // Calling the user font entry's Load method will end up setting our
  // status to Loading, but the spec requires us to set it to Loading
  // here.
  SetStatus(FontFaceLoadStatus::Loading);

  DoLoad();

  return mLoaded;
}
Esempio n. 5
0
/**
 * @function OnLoad
 */
void GRIPFrame::OnLoad(wxCommandEvent& WXUNUSED(event)){
    wxString filename = wxFileSelector(wxT("Choose a file to open"),wxT("../scene/"),wxT(""),wxT(""), // -- default extension
                                       wxT("*.urdf"), 0);
    if ( !filename.empty() ) {
        DoLoad(string(filename.mb_str()));
    }
}
Esempio n. 6
0
bool IStrategy::Load(std::istream& s)
{
	int emptyLineCount(0);
	std::map<std::string, std::string> configurePairs;
	std::string line;
	while (std::getline(s, line))
	{
		Trim(line);
		if (!line.empty())
		{
			emptyLineCount = 0;
			if ('#' != line[0])
			{
				auto splitPos = line.find_first_of(':');
				if (std::string::npos != splitPos)
				{
					auto key = line.substr(0, splitPos);
					auto value = line.substr(splitPos + 1);

					Trim(key);
					Trim(value);
					configurePairs[key] = value;
				}
			}
		}
		else
		{
			emptyLineCount++;
			if (1 == emptyLineCount)
			{
				break;
			}
		}
	}

	auto itName = configurePairs.find("Name");
	if (itName != configurePairs.end())
	{
		SetName(itName->second);
	}
	else
	{
		return false;
	}

	auto itDescription = configurePairs.find("Description");
	if (itDescription != configurePairs.end())
	{
		SetDescription(itDescription->second);
	}
	else
	{
		return false;
	}

	return DoLoad(configurePairs);
}
Esempio n. 7
0
/**
 * @function OnQuickLoad
 * @brief Load the latest correctly loaded .rscene
 */
void GRIPFrame::OnQuickLoad(wxCommandEvent& WXUNUSED(event)) {

    ifstream lastloadFile;
    lastloadFile.open(".lastload", ios::in);
    if(lastloadFile.fail()){
        cout << "--(!) No previously loaded files (!)--" << endl;
        return;
    }
    string line;
    getline(lastloadFile,line);
    lastloadFile.close();
    DoLoad(line);
}
Esempio n. 8
0
File: wasap.c Progetto: 070499/xbmc
static void SaveWav(void)
{
	byte module[ASAP_MODULE_MAX];
	int module_len;
	ASAP_State asap;
	int duration;
	static OPENFILENAME ofn = {
		sizeof(OPENFILENAME),
		NULL,
		0,
		"WAV files (*.wav)\0*.wav\0\0",
		NULL,
		0,
		0,
		wav_filename,
		MAX_PATH,
		NULL,
		0,
		NULL,
		"Select output file",
		OFN_ENABLESIZING | OFN_EXPLORER | OFN_OVERWRITEPROMPT,
		0,
		0,
		"wav",
		0,
		NULL,
		NULL
	};
	if (!loadModule(current_filename, module, &module_len))
		return;
	if (!DoLoad(&asap, module, module_len))
		return;
	duration = asap.module_info.durations[current_song];
	if (duration < 0) {
		if (MessageBox(hWnd,
			"This song has unknown duration.\n"
			"Use \"File information\" to update the source file with the correct duration.\n"
			"Do you want to save 3 minutes?",
			"Unknown duration", MB_YESNO | MB_ICONWARNING) != IDYES)
			return;
		duration = 180000;
	}
	ASAP_PlaySong(&asap, current_song, duration);
	strcpy(wav_filename, current_filename);
	ASAP_ChangeExt(wav_filename, "wav");
	ofn.hwndOwner = hWnd;
	if (!GetSaveFileName(&ofn))
		return;
	if (!DoSaveWav(&asap))
		ShowError("Cannot save file");
}
Esempio n. 9
0
bool CLibrary::Load( const char* const pszFilename )
{
	assert( pszFilename );

	Free();

	m_hLibrary = DoLoad( pszFilename );

	if( !IsLoaded() )
		return false;

	m_szName = pszFilename;

	return true;
}
Esempio n. 10
0
bool CPNGFile::Load(unsigned char *pFile, int iSize)
{
	// clear any previously loaded file
	Clear();
	// store file ptr as not owned
	this->pFile = pFile;
	iFileSize=iSize;
	fpFileOwned=false;
	// perform the loading
	if (!DoLoad())
	{
		Clear();
		return false;
	}
	// reset file-field
	this->pFile = NULL; iFileSize=0;
	// success
	return true;
}
Esempio n. 11
0
bool CLibrary::Load( const CLibArgs& args )
{
	Free();

	const auto& platform = CPlatform::GetCurrentPlatform();

	char szBuffer[ MAX_PATH ];

	const char* pszPrefix = !args.ShouldDisablePrefixes() ? platform.GetDefaultLibPrefix() : "";

	//Handle the override extension as a list of 1 extension.
	const char* const pszOverrideExt[] = 
	{
		args.GetOverrideExtension()
	};

	const char* const* pszExts = !args.GetOverrideExtension() ? platform.GetLibExts() : pszOverrideExt;

	const size_t uiCount = !args.GetOverrideExtension() ? platform.GetNumLibExts() : 1;

	for( size_t uiIndex = 0; uiIndex < uiCount; ++uiIndex )
	{
		const int iResult = snprintf( szBuffer, sizeof( szBuffer ), "%s%s%s%s%s", args.GetPath(), *args.GetPath() ? "/" : "", pszPrefix, args.GetFilename(), pszExts[ uiIndex ] );

		if( iResult < 0 || static_cast<size_t>( iResult ) >= sizeof( szBuffer ) )
			return false;

		m_hLibrary = DoLoad( szBuffer );

		if( IsLoaded() )
		{
			//Use the base name so users can compare it.
			m_szName = args.GetFilename();

			return true;
		}
	}

	return false;
}
Esempio n. 12
0
BOOL MainWnd_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
    DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL |
                    LVS_SINGLESEL | LVS_REPORT | LVS_OWNERDRAWFIXED;
    DWORD dwExStyle = WS_EX_CLIENTEDGE;
    g_hListView = CreateWindowEx(dwExStyle, WC_LISTVIEW, NULL, dwStyle,
                                 0, 0, 0, 0,
                                 hwnd, (HMENU)1, g_hInstance, NULL);
    if (g_hListView == NULL)
        return FALSE;

    if (!LV_Init(g_hListView))
        return FALSE;

    if (!DoLoad())
        return FALSE;

    UINT State = LVIS_SELECTED | LVIS_FOCUSED;
    ListView_SetItemState(g_hListView, 0, State, State);
    SetFocus(g_hListView);
    return TRUE;
}
Esempio n. 13
0
void
FontFace::InitializeSource(const StringOrArrayBufferOrArrayBufferView& aSource)
{
  if (aSource.IsString()) {
    if (!ParseDescriptor(eCSSFontDesc_Src,
                         aSource.GetAsString(),
                         mDescriptors->mSrc)) {
      if (mLoaded) {
        // The SetStatus call we are about to do assumes that for
        // FontFace objects with sources other than ArrayBuffer(View)s, that the
        // mLoaded Promise is rejected with a network error.  We get
        // in here beforehand to set it to the required syntax error.
        mLoaded->MaybeReject(NS_ERROR_DOM_SYNTAX_ERR);
      }

      SetStatus(FontFaceLoadStatus::Error);
      return;
    }

    mSourceType = eSourceType_URLs;
    return;
  }

  mSourceType = FontFace::eSourceType_Buffer;

  if (aSource.IsArrayBuffer()) {
    GetDataFrom(aSource.GetAsArrayBuffer(),
                mSourceBuffer, mSourceBufferLength);
  } else {
    MOZ_ASSERT(aSource.IsArrayBufferView());
    GetDataFrom(aSource.GetAsArrayBufferView(),
                mSourceBuffer, mSourceBufferLength);
  }

  SetStatus(FontFaceLoadStatus::Loading);
  DoLoad();
}
Esempio n. 14
0
HRESULT CVCAConfigure::LoadEngine( DWORD dwEngId, LPTSTR lpszFilename )
{
	HRESULT hr = E_FAIL;
	USES_CONVERSION;

	do
	{
		// Reset this engine
		if( LIBVCA_ERROR == libvca_reset_ALLdefaults( dwEngId ) )
		{
			break;
		}

		// Load the file
		libvca_loadCfgFromXMLFile( T2A(lpszFilename), dwEngId, VCA_CFGFLAG_ALL );

		// Carry on, even if file was invalid - to get the default values
		hr = DoLoad( dwEngId );

	}
	while( 0 );

	return hr;
}
Esempio n. 15
0
HRESULT CVCAConfigure::LoadEngine( DWORD dwEngId, char *pszBuf, unsigned int uiBufLen )
{
	HRESULT hr = E_FAIL;
	USES_CONVERSION;

	do
	{
		// Reset this engine
		if( LIBVCA_ERROR == libvca_reset_ALLdefaults( dwEngId ) )
		{
			break;
		}

		// Load the file
		libvca_loadCfgFromXMLBuffer(pszBuf, uiBufLen, dwEngId, VCA_CFGFLAG_ALL );

		// Carry on, even if file was invalid - to get the default values
		hr = DoLoad( dwEngId );

	}
	while( 0 );

	return hr;
}
Esempio n. 16
0
string osl_ExecuteSystemFunction(vector<OSL_LEXEM>* list)
{
	string _result;
	_result.resize(0);

	#ifdef _DEBUG_OSL
	WriteToLog(DEFAULT_OSL_LOG_NAME, "Executing system function...");
	#endif

	unsigned int param_count = 1;

	for(vector<OSL_LEXEM>::iterator it = list->begin();
		it != list->end();
		it++)
	{
		OSL_LEXEM lx = *it;

		if(osl_IsComma(lx.token))
			param_count++;
	}

	vector<OSL_LEXEM>::iterator i_first = list->begin();
	OSL_LEXEM first = *i_first;

	if(first.token == "echo")
	{
		vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
		OSL_LEXEM second = *i_second;

		char* message = new char[second.token.length()+1];
		strcpy(message, (char*)second.token.data());

		message = osl_RemoveQuotesChr(message);
		DoEcho(message);
	}
	else if(first.token == "load")
	{
		vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
		OSL_LEXEM second = *i_second;

		bool ok = DoLoad(osl_RemoveQuotesStr(second.token));

		ok == true ? _result = OSL_EXEC_OK : _result = OSL_EXEC_FAIL;
	}
	else if(first.token == "exit")
	{
		DoExit();
	}
	else if(first.token == "init")
	{
					vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
					OSL_LEXEM second = *i_second;

					if(second.token == "gui")
					{
						if(!gui)
						{
							gui = new GUI();
							_result = OSL_EXEC_OK;
						}
						else
						{
							osl_Error("GUI already initialized");
							_result = OSL_EXEC_FAIL;
						}
					}
					else
					{
						osl_Error("init(): unknown parameter");
						_result = OSL_EXEC_FAIL;
					}
	}
	else if(first.token == "loadconfig")
	{
		vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
		OSL_LEXEM second = *i_second;

		if(osl_IsStrConstant(second.token))
		{
			char* file = new char[second.token.length()+1];
			strcpy(file, (char*)second.token.data());
			file = osl_RemoveQuotesChr(file);

			bool ok = LoadConfig(file, &cfg);

			if(ok)
			{
				ApplyConfig(&cfg);
				_result = OSL_EXEC_OK;
			}
			else
				_result = OSL_EXEC_FAIL;
		}
		else
			osl_Error("LoadConfig(): Invalid argument");
	}
	else if(first.token == "loadfontfromfile")
	{
		WriteToLog(DEFAULT_OSL_LOG_NAME, "Trying to load font from file...");

		if(param_count == 3)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;

			if(osl_IsIntConstant(third.token) &&
				osl_IsIntConstant(fourth.token))
			{
				try
				{
					if(LoadFontFromFile((char*)osl_RemoveQuotesStr(second.token).c_str(),
						osl_StrToInt(third.token),
						osl_StrToInt(fourth.token)))
					{
						WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadFontFromFile OK");
						_result = OSL_EXEC_OK;
					}
					else
					{
						WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadFontFromFile FAILED");
						_result = OSL_EXEC_FAIL;
					}
				}
				catch(...)
				{
					osl_Error("Exception in try block: LoadFontFromFile");
					_result = OSL_EXEC_FAIL;
				}			
			}
			else
			{
				osl_Error("LoadFontFromFile() error: incompatible types");
				_result = OSL_EXEC_FAIL;
			}
		}
		else
		{
			osl_Error("LoadFontFromFile() error: function require one parameter");
			_result = OSL_EXEC_FAIL;
		}
	}
	else if(first.token == "loadfont")
	{
		WriteToLog(DEFAULT_OSL_LOG_NAME, "Trying to load font...");
		if(param_count == 4)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;
			vector<OSL_LEXEM>::iterator i_fifth = list->begin()+8;
			OSL_LEXEM fifth = *i_fifth;

			try
			{
				bool ok =
					LoadFont((char*)osl_RemoveQuotesStr(second.token).c_str(),
						osl_StrToInt(third.token),
						osl_StrToInt(fourth.token),
						(char*)osl_RemoveQuotesStr(fifth.token).c_str());

				ok == true ? _result = OSL_EXEC_OK : _result = OSL_EXEC_FAIL;
			}
			catch(...)
			{
				osl_Error("Exception in try block: LoadFont");
				_result = OSL_EXEC_FAIL;
			}
			WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadFont OK");

		}
		else
		{
			osl_Error("LoadFont() error: function requires two parametres");
			_result = OSL_EXEC_FAIL;
		}
	}
	else if(first.token == "loadtexture")
	{
		WriteToLog(DEFAULT_OSL_LOG_NAME, "Trying to load texture...");
		if(param_count == 1)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;

			try
			{
				string s = osl_RemoveQuotesStr(second.token);
				char* n = new char[strlen(s.data())+1];
				sprintf(n, "%s\0", s.data());

				if(!LoadTexture(n))
				{
					osl_Error("LoadTexture() failed");
					_result = OSL_EXEC_FAIL;
				}
				else
					_result = OSL_EXEC_OK;
				delete[] n;
			}
			catch(...)
			{
				osl_Error("Exception in try block: LoadTexture");
				_result = OSL_EXEC_FAIL;
			}
			WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadTexture OK");
		}
		else
		{
			osl_Error("LoadTexture() error: function requires one parameter");
			_result = OSL_EXEC_FAIL;
		}
	}
	else if(first.token == "newguielem")
	{
		if(param_count == 2)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;

			NewGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token));
		}
		else
			osl_Error("NewGUIElem() error: function requires two parametres");
	}
	else if(first.token == "setguielem")
	{
		if(param_count == 3)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;

			SetGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token),
				osl_RemoveQuotesStr(fourth.token));
		}
		else if(param_count == 5)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;
			vector<OSL_LEXEM>::iterator i_fifth = list->begin()+8;
			OSL_LEXEM fifth = *i_fifth;
			vector<OSL_LEXEM>::iterator i_sixth = list->begin()+10;
			OSL_LEXEM sixth = *i_sixth;

			SetGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token),
				osl_RemoveQuotesStr(fourth.token),
				osl_RemoveQuotesStr(fifth.token),
				osl_RemoveQuotesStr(sixth.token));
		}
		else if(param_count == 6)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;
			vector<OSL_LEXEM>::iterator i_fifth = list->begin()+8;
			OSL_LEXEM fifth = *i_fifth;
			vector<OSL_LEXEM>::iterator i_sixth = list->begin()+10;
			OSL_LEXEM sixth = *i_sixth;
			vector<OSL_LEXEM>::iterator i_seventh = list->begin()+12;
			OSL_LEXEM seventh = *i_seventh;

			SetGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token),
				osl_RemoveQuotesStr(fourth.token),
				osl_RemoveQuotesStr(fifth.token),
				osl_RemoveQuotesStr(sixth.token),
				osl_RemoveQuotesStr(seventh.token));
		}
		else
			osl_Error("NewGUIElem() error: incorrect number of parametres");
	}
	else if(first.token == "createplayer")
	{
		if(param_count == 28)
		{
			vector<OSL_LEXEM>::iterator p1 = list->begin()+2;
			vector<OSL_LEXEM>::iterator p2 = list->begin()+4;
			vector<OSL_LEXEM>::iterator p3 = list->begin()+6;
			vector<OSL_LEXEM>::iterator p4 = list->begin()+8;
			vector<OSL_LEXEM>::iterator p5 = list->begin()+10;
			vector<OSL_LEXEM>::iterator p6 = list->begin()+12;
			vector<OSL_LEXEM>::iterator p7 = list->begin()+14;
			vector<OSL_LEXEM>::iterator p8 = list->begin()+16;
			vector<OSL_LEXEM>::iterator p9 = list->begin()+18;
			vector<OSL_LEXEM>::iterator p10 = list->begin()+20;
			vector<OSL_LEXEM>::iterator p11 = list->begin()+22;
			vector<OSL_LEXEM>::iterator p12 = list->begin()+24;
			vector<OSL_LEXEM>::iterator p13 = list->begin()+26;
			vector<OSL_LEXEM>::iterator p14 = list->begin()+28;
			vector<OSL_LEXEM>::iterator p15 = list->begin()+30;
			vector<OSL_LEXEM>::iterator p16 = list->begin()+32;
			vector<OSL_LEXEM>::iterator p17 = list->begin()+34;
			vector<OSL_LEXEM>::iterator p18 = list->begin()+36;
			vector<OSL_LEXEM>::iterator p19 = list->begin()+38;
			vector<OSL_LEXEM>::iterator p20 = list->begin()+40;
			vector<OSL_LEXEM>::iterator p21 = list->begin()+42;
			vector<OSL_LEXEM>::iterator p22 = list->begin()+44;
			vector<OSL_LEXEM>::iterator p23 = list->begin()+46;
			vector<OSL_LEXEM>::iterator p24 = list->begin()+48;
			vector<OSL_LEXEM>::iterator p25 = list->begin()+50;
			vector<OSL_LEXEM>::iterator p26 = list->begin()+52;
			vector<OSL_LEXEM>::iterator p27 = list->begin()+54;
			vector<OSL_LEXEM>::iterator p28 = list->begin()+56;

			CreatePlayer((*p1).token, (*p2).token, (*p3).token, (*p4).token,
				(*p5).token, (*p6).token, (*p7).token, (*p8).token, (*p9).token,
				(*p10).token, (*p11).token, (*p12).token, (*p13).token, (*p14).token,
				(*p15).token, (*p16).token, (*p17).token, (*p18).token, (*p19).token,
				(*p20).token, (*p21).token, (*p22).token, (*p23).token, (*p24).token,
				(*p25).token, (*p26).token, (*p27).token, (*p28).token);


		}
		else
			osl_Error("CreatePlayer() error: incorrect number of parametres");
	}
	else if(first.token == "createpowerup")
	{
		if(param_count == 4)
		{
			vector<OSL_LEXEM>::iterator p1 = list->begin()+2;
			vector<OSL_LEXEM>::iterator p2 = list->begin()+4;
			vector<OSL_LEXEM>::iterator p3 = list->begin()+6;
			vector<OSL_LEXEM>::iterator p4 = list->begin()+8;

			CreatePowerup((*p1).token, (*p2).token, (*p3).token, (*p4).token);

		}
		else
			osl_Error("CreatePowerup() error: incorrect number of parametres");
	}
	else if(first.token == "createenemy")
	{
		if(param_count == 3)
		{
			vector<OSL_LEXEM>::iterator p1 = list->begin()+2;
			vector<OSL_LEXEM>::iterator p2 = list->begin()+4;
			vector<OSL_LEXEM>::iterator p3 = list->begin()+6;

			CreateEnemy((*p1).token, (*p2).token, (*p3).token);
		}
		else
			osl_Error("CreateEnemy() error: incorrect number of parametres");
	}
	else
		osl_Error("Command is not implemented yet");

	return _result;

}
Esempio n. 17
0
void MainWnd_OnReload(HWND hwnd)
{
    DoLoad();
}
Esempio n. 18
0
//______________________________________________________________________________
void MainWindow::init()
{   //initialisation of the gui
    //recall objects from .ui file and connect them with user functions


    ui_ConvertButton    = this->findChild<QCommandLinkButton*>("ConvertButton");
    ui_ExitButton       = this->findChild<QCommandLinkButton*>("ExitButton");
    ui_OutputButton     = this->findChild<QCommandLinkButton*>("OutputButton");

    connect(ui_ConvertButton,   SIGNAL(clicked()), this, SLOT(DoConvert()));
    connect(ui_ExitButton,      SIGNAL(clicked()), this, SLOT(DoExit()));
    connect(ui_OutputButton,      SIGNAL(clicked()), this, SLOT(DoOutput()));

    ui_actionExit = this->findChild<QAction*>("actionExit");
    ui_actionLoad = this->findChild<QAction*>("actionLoad");
    ui_actionSave = this->findChild<QAction*>("actionSave");
    connect(ui_actionExit, SIGNAL(triggered()), this, SLOT(DoExit()));
    connect(ui_actionSave, SIGNAL(triggered()), this, SLOT(DoSave()));
    connect(ui_actionLoad, SIGNAL(triggered()), this, SLOT(DoLoad()));


    ui_EmaxSpinBox         = this->findChild<QSpinBox*>("EmaxSpinBox");
    ui_BinSizeSpinBox      = this->findChild<QSpinBox*>("BinSizeSpinBox");
    ui_ASpinBox            = this->findChild<QSpinBox*>("ASpinBox");
    ui_ZSpinBox            = this->findChild<QSpinBox*>("ZSpinBox");

    ui_SpinParitySpinBox   = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox");
    ui_SpinParitySpinBox_2   = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_2");
    ui_SpinParitySpinBox_n1  = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n1");
    ui_SpinParitySpinBox_n2  = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n2");
    ui_TorASpinBox_1       = this->findChild<QDoubleSpinBox*>("TorASpinBox_1");
    ui_TorASpinBox_2       = this->findChild<QDoubleSpinBox*>("TorASpinBox_2");
    ui_PairSpinBox         = this->findChild<QDoubleSpinBox*>("PairSpinBox");
    ui_ParityBox         = this->findChild<QDoubleSpinBox*>("ParityBox");

    ui_E1doubleSpinBox_1   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_1");
    ui_E1doubleSpinBox_2   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_2");
    ui_E1doubleSpinBox_3   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_3");
    ui_E1doubleSpinBox_4   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_4");
    ui_E1doubleSpinBox_5   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_5");
    ui_E1doubleSpinBox_6   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_6");
    ui_M1doubleSpinBox_1   = this->findChild<QDoubleSpinBox*>("M1doubleSpinBox_1");


    ui_OutputLabel    = this->findChild<QLabel*>("OutputLabel");
    ui_TorALabel_1    = this->findChild<QLabel*>("TorALabel_1");
    ui_TorALabel_2    = this->findChild<QLabel*>("TorALabel_2");
    ui_EmaxLabel      = this->findChild<QLabel*>("EmaxLabel");
    ui_E1label_1      = this->findChild<QLabel*>("E1Label_1");
    ui_E1label_2      = this->findChild<QLabel*>("E1Label_2");
    ui_E1label_3      = this->findChild<QLabel*>("E1Label_3");
    ui_E1label_4      = this->findChild<QLabel*>("E1Label_4");
    ui_E1label_5      = this->findChild<QLabel*>("E1Label_5");
    ui_E1label_6      = this->findChild<QLabel*>("E1Label_6");
    ui_M1label_1      = this->findChild<QLabel*>("M1Label_1");
    ui_M1label_2      = this->findChild<QLabel*>("M1Label_2");
    ui_Levellabel     = this->findChild<QLabel*>("Levellabel");
    ui_Spectrumlabel  = this->findChild<QLabel*>("SpectrumLabel");

    ui_progressbar      = this->findChild<QProgressBar*>("progressBar");

    ui_E1pushButton      = this->findChild<QPushButton*>("E1pushButton");
    connect(ui_E1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile1()));

    ui_M1pushButton      = this->findChild<QPushButton*>("M1pushButton");
    connect(ui_M1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile2()));

    ui_LevelpushButton      = this->findChild<QPushButton*>("LevelpushButton");
    connect(ui_LevelpushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile3()));

    ui_LevelpushButton_2      = this->findChild<QPushButton*>("LevelpushButton_2");
    connect(ui_LevelpushButton_2, SIGNAL(clicked()),this,SLOT(Clear()));

    ui_SpectrumButton      = this->findChild<QPushButton*>("SpectrumButton");
    connect(ui_SpectrumButton, SIGNAL(clicked()),this,SLOT(DoSelectfile4()));

    ui_DensityEnergyComboBox = this->findChild<QComboBox*>("DensityEnergyComboBox");
    connect(ui_DensityEnergyComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoModel()));

    ui_ReactionComboBox = this->findChild<QComboBox*>("ReactionComboBox");
    connect(ui_ReactionComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoEmax()));

    ui_E1StrengthComboBox = this->findChild<QComboBox*>("E1StrengthComboBox");
    connect(ui_E1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoE1()));

    ui_M1StrengthComboBox = this->findChild<QComboBox*>("M1StrengthComboBox");
    connect(ui_M1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoM1()));

    ui_E1pushButton->hide();  
    ui_E1label_6->hide();
    ui_E1doubleSpinBox_3->hide();
    ui_E1doubleSpinBox_4->hide();
    ui_E1doubleSpinBox_5->hide();
    ui_E1doubleSpinBox_6->hide();

    ui_M1label_1->hide();
    ui_M1label_2->hide();
    ui_M1doubleSpinBox_1->hide();
    ui_M1pushButton->hide();

    ui_Spectrumlabel->hide();
    ui_SpectrumButton->hide();


}
Esempio n. 19
0
long ProjectPrefsGUI::HandleButtonClick(NativeControl Handle, NativeGUIWin NW, int ButtonID)
{

if (SwapInProgress || MoveInProgress)
	{
	SwapInProgress = MoveInProgress = 0;
#ifdef _WIN32
	if (Curse)
		SetClassLong(GetDlgItem(NativeWin, IDC_PARLIST), GCL_HCURSOR, (long)Curse);
#endif // _WIN32
	EndPointer();
	} // if
switch (ButtonID)
	{
	case ID_KEEP:
		{
		AppScope->MCP->SetParam(1, WCS_TOOLBARCLASS_MODULES, WCS_TOOLBAR_CLOSE_MOD,
			WCS_TOOLBAR_ITEM_PPG, 0);
		break;
		} // 
	case IDCANCEL:
		{
		DoCancel();
		//AppScope->MCP->SetParam(1, WCS_TOOLBARCLASS_MODULES, WCS_TOOLBAR_CLOSE_MOD,
		//	WCS_TOOLBAR_ITEM_PPG, 0);
		break;
		} // 
	case IDC_MATRIX_1:
		{
		SetViewport(0);
		break;
		} // 
	case IDC_MATRIX_2:
		{
		SetViewport(1);
		break;
		} // 
	case IDC_MATRIX_3:
		{
		SetViewport(2);
		break;
		} // 
	case IDC_MATRIX_4:
		{
		SetViewport(3);
		break;
		} // 
	case IDC_MATRIX_5:
		{
		SetViewport(4);
		break;
		} // 
	case IDC_MATRIX_6:
		{
		SetViewport(5);
		break;
		} // 
	case IDC_MATRIX_7:
		{
		SetViewport(6);
		break;
		} // 
	case IDC_MATRIX_8:
		{
		SetViewport(7);
		break;
		} // 
	case IDC_MATRIX_9:
		{
		SetViewport(8);
		break;
		} // 
	case IDC_MATRIX_10:
		{
		SetViewport(9);
		break;
		} // 
	case IDC_MATRIX_11:
		{
		SetViewport(10);
		break;
		} // 
	case IDC_MATRIX_12:
		{
		SetViewport(11);
		break;
		} // 
	case ID_DEFAULT:
		{
		DoDefaultDir();
		break;
		} // 
	case IDC_ADD:
		{
		DoAdd();
		break;
		} // 
	case IDC_MOVEDLUP:
		{
		HandleMove(0); // up
		break;
		} // up
	case IDC_MOVEDLDOWN:
		{
		HandleMove(1); // down
		break;
		} // down
/*
	case IDC_SWAP:
		{
		//DoSwap(0);
		break;
		} // 
	case IDC_MOVE:
		{
		//DoMove(0);
		break;
		} // 
*/
	case IDC_REMOVE:
		{
		DoRemove();
		break;
		} // 
	case IDC_READONLY:
		{
		DoReadOnly();
		break;
		} // 
	case IDC_LOAD:
		{
		DoLoad();
		break;
		} // 
	case IDC_SET:
		{
		DoAdvConfig(1);
		break;
		} // SET
	case IDC_UNSET:
		{
		DoAdvConfig(2);
		break;
		} // IDC_UNSET
	} // switch

return(0);

} // ProjectPrefsGUI::HandleButtonClick
Esempio n. 20
0
bool CmdProc::DoExecId(ICmdParam& cmd)
{
	Logger& logger(this_logger());

	if (cmd.param1 == CP_LOAD_FILE)
	{
		if(!DoLoad(cmd.extra1))
		{
			logger.LogError(_hT("failed_to_load_file %s!"),cmd.extra1);
			return false;
		}
		return true;
	}
	else if (cmd.param1 == CP_SAVE_FILE)
	{
		return DoSave(cmd.extra1);
	}
	else if (cmd.param1 == CP_INIT)
	{
		if (cmd.extra1 != "")
		{

		}
		else if (!TestId(CmdProc::CP_SAVEAS, cmd.extra1))
		{
			return false;
		}

		//if (cmd.extra1 == "")
		//{
		//	return true;
		//}

		cmd.param1 = CP_LOAD_FILE;
		if (!DoExecId(cmd)) return false;
		return true;
	}
	else if (cmd.param1 == CP_LOAD)
	{

		if (cmd.extra1 != "")
		{

		}
		else if (!TestId(CmdProc::CP_SAVEAS, cmd.extra1))
		{
			return false;
		}

		if (cmd.extra1 == "")
		{
			String exts;
			TestId(CP_FILEEXT, exts);

			if (Wrapper::FileDialog(cmd.extra1, IDefs::FD_OPEN, "", exts) == IDefs::BTN_CANCEL)
			{
				return false;
			}
		}
		cmd.param1 = CP_LOAD_FILE;
		if (!DoExecId(cmd)) return false;
		return true;
	}

	else if(cmd.param1==CP_SAVE_TEMP)
	{
		if (cmd.extra1 != "")
		{

		}
		else if (cmd.extra2 == "")
		{
			return false;
		}
		else
		{
			cmd.extra1 = cmd.extra2 + ".temp";
		}

		cmd.param1 = CP_SAVE_FILE;
		return DoExecId(cmd);
	}

	else if(cmd.param1==CP_SAVE_POST)
	{
		if (cmd.extra1 == ""||cmd.extra2=="")
		{
			return false;
		}

		if (cmd.extra1 != cmd.extra2)
		{
			if (!FSObject::current().Rename(cmd.extra1, cmd.extra2, 1))
			{
				logger.LogError(_hT("failed_to_save_file %s!"),cmd.extra2);
				return false;
			}
		}

		fn.SetFilename(cmd.extra2);

		return true;
	}
	else if(cmd.param1==CP_SAVE||cmd.param1==CP_SAVEAS)
	{

		if(!TestId(CmdProc::CP_SAVEAS,cmd.extra1))
		{
			cmd.param2 = -1;
			return false;
		}

		if(cmd.extra1==""||cmd.param1==CP_SAVEAS)
		{
			String exts;
			TestId(CP_FILEEXT,exts);

			if (Wrapper::FileDialog(cmd.extra1, IDefs::FD_SAVE | IDefs::FD_OVERWRITE_PROMPT, "", exts) == IDefs::BTN_CANCEL)
			{
				cmd.param2 = -2;
				return false;
			}
		}


		if (!FSObject::current().FileExists(cmd.extra1))
		{
			cmd.extra2 = cmd.extra1;
		}
		else
		{
			std::swap(cmd.extra1,cmd.extra2);
		}

		cmd.param2 = 0;

		cmd.param1=CP_SAVE_TEMP;
		if(!DoExecId(cmd))
		{
			logger.LogError(_hT("failed_to_save_file %s!"),cmd.extra2);
			return false;
		}

		cmd.param1=CP_SAVE_POST;
		if(!DoExecId(cmd)) return false;

		return true;
	}
	else
	{
		return false;
	}
}
Esempio n. 21
0
global bool InitSoundDriver() {
	int		patchNum;
	Handle	patchHandle;


	/*	Load sound driver
	 */

	#ifdef	IBM
		if((soundDrv = LoadHandle(soundDriver)) == (Handle)NULL) {
			RAlert(E_CANT_FIND, soundDriver);
			return (FALSE);
		}
		LockHandle(soundDrv);
	#endif

	#ifdef	AMIGA
		if(!(bseg = (struct Segment *) LoadSeg(soundDriver))) {
			RAlert(E_CANT_FIND, soundDriver);
			return (FALSE);
		}
		drvHandle = (unsigned char far *) (((ulong) bseg << 2) + 4);
		soundDrv = (Handle) &drvHandle;

		if((DoSound(SPatchReq,(void far *) *(soundDrv),
			(int far *) &numberOfVoices, (int far *) &numberOfDACs,
			(int far *) &devID) & 0x7f) == 5) {
			if(dummysoundbank) {
				int bankFile;
				long bankIndex = 0, bankSize;

				if((bankFile = open("patch.005")) == NULL) {
					RAlert(E_NO_PATCH);
					return (FALSE);
				}

				read(bankFile,&bankSize,2);
				bankSize = dsoundsize;

				while(bankSize > 1024) {
					read(bankFile,(dummysoundbank + bankIndex),1024);
					bankSize -= 1024;
					bankIndex += 1024;
				}
				if(bankSize) {
					read(bankFile,(dummysoundbank + bankIndex),bankSize);
				}

				close(bankFile);
			}
			else {
				UnLoadSeg(bseg);
				if(!(bseg = (struct Segment *) LoadSeg("amiga3v.drv"))) {
					RAlert(E_CANT_FIND,soundDriver);
					return (FALSE);
				}
				drvHandle = (unsigned char far *) (((ulong) bseg << 2) + 4);
				soundDrv = (Handle) &drvHandle;
			}
		}
		else {
			if(dummysoundbank) {
				FreeMem(dummysoundbank,dsoundsize);
				dummysoundbank = NULL;
			}
		}
		seglist[segcount++] = bseg;
	#endif


	/* Load patch (if one is needed)
	 * If bit 7 of the patch number is set, then the patch
	 * will need to be locked permanently in hunk
	 */
	patchNum = DoSound(SPatchReq,(void far *) *(soundDrv),
		(int far *) &numberOfVoices, (int far *) &numberOfDACs, 
		(int far *) &devID);

	#ifdef	AMIGA
		if((patchNum & 0x7f) == 5) {	 /* This Kludge is temporary, until		*/
			patchNum = -1;					 /* the Amiga interpreter is capable of*/
		}										 /* handling 64k+ resources				*/
	#endif

	if(patchNum != -1) {
		if ((patchNum&0x7f) == 10)
			patchHandle = DoLoad(RES_PATCH,(patchNum & 0x7f)); 
		else			
			patchHandle = ResLoad(RES_PATCH,(patchNum & 0x7f));
		if(patchNum & 0x80) {
			ResLock(RES_PATCH,(patchNum & 0x7f),TRUE);
			LockHandle(patchHandle);
		}
	}

	/*	Initialize sound driver
	 */

	#ifdef	IBM
		if(DoSound(SInit,(char far *) *(patchHandle),0) == -1) {
			DisposeHandle(soundDrv);
			RAlert(E_NO_MUSIC);
			return(FALSE);
		}
	#endif

	#ifdef	AMIGA
		if(dummysoundbank) {
			DoSound(SInit,dummysoundbank);
		}
		else {
			DoSound(SInit,(char far *) *(patchHandle),0);
		}
	#endif

	InitList(&soundList);
	InstallServer(SoundServer,1);

	DoSound(SProcess,TRUE);

	return(TRUE);
}
//--------------------------------------------------------------------------------
bool CSystemMonitorHandlerThread::DoCommand()
	{
	ASSERT(NUM_OF_CMDS == sizeof(g_pCommands) / sizeof(LPCTSTR));

	bool bRv = true;

	m_sCurCmd.MakeLower();
	m_sCurCmd.TrimLeft();
	m_sCurCmd.TrimRight();

	TRY
		{
		CString sTemp(m_sCurCmd.Left(4));

		if(sTemp == "hey")
			m_socket.Send("there\r\n\r\n", 6, CSmallSocket::WAITFORWOULDBLOCK);
		else
			{
			for(int i = 0; i < NUM_OF_CMDS; i++)
				{
				if(strncmp(sTemp, g_pCommands[i], 4) == 0)
					break;
				}

			if(i == CMDEXIT)
				{
				m_sCurCmd.Empty();
				m_sUser.Empty();
				m_sPass.Empty();
				return false;
				}

			if(i == CMDUSER)
				{
				if(m_sCurCmd.GetLength() > 5)
					DoUser(m_sCurCmd.Mid(5));
				m_sCurCmd.Empty();
				return true;
				}

			if(i == CMDPASS)
				{
				if(m_sCurCmd.GetLength() > 5)
					DoPass(m_sCurCmd.Mid(5));
				m_sCurCmd.Empty();
				return true;
				}

			if(! m_bLoggedIn)
				{
				m_sCurCmd.Empty();
				return true;
				}

			switch(i)
				{
				case CMDLOAD:
					if(m_sCurCmd.GetLength() > 5)
						DoLoad(m_sCurCmd.Mid(5));
					else
						{
						CSSConfigGeneral config;
						DoLoad(config.m_sLicenseFileDefault);
						}
					break;
				case CMDLIST:
					DoList();
					break;
				case CMDPAUSE:
					DoPause();
					break;
				case CMDCONT:
					DoContinue();
					break;
				case CMDREVOKE:
					DoRevoke();
					break;
				case CMDHELP:
					{
					for(int i = 0; i < NUM_OF_CMDS; i++)
						{
						CString sTemp;
						sTemp.Format("%s\r\n", g_pCommands[i]);
						m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
						}
					}
					break;
				case CMDSERIAL:
					{
					CString sTemp;
					for(int i = 0; CPlatformInfo::GetProcessorSerialNumber(sTemp, i); i++)
						{
						sTemp += "\r\n";
						m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
						}
					}
					break;

				case CMDDONGLE:
					DoDongle();
					break;

				case CMDCONFIG:
					DoConfigDump();
					break;

				default:
					m_socket.Send("what?\r\n\r\n", 6, CSmallSocket::WAITFORWOULDBLOCK);
					break;
				}
			}
		}
	CATCH_ALL(e)
		{
		}
	END_CATCH_ALL

	m_sCurCmd.Empty();
	return bRv;
	}