コード例 #1
0
	DEPTH_WRITE_MASK DepthWriteMaskFromString(const char* str)
	{
		if (!str)
			return DEPTH_WRITE_MASK_ALL;
		if (_stricmp(str, "DEPTH_WRITE_MASK_ZERO") == 0)
		{
			return DEPTH_WRITE_MASK_ZERO;
		}

		if (_stricmp(str, "DEPTH_WRITE_MASK_ALL") == 0)
		{
			return DEPTH_WRITE_MASK_ALL;
		}

		Logger::Log(FB_ERROR_LOG_ARG, FormatString("%s is not valid DepthWriteMask", str).c_str());
		return DEPTH_WRITE_MASK_ALL;
	}
コード例 #2
0
ファイル: 3dclock.cpp プロジェクト: pvaut/Z-Flux
void T3DObjectClock::render_exec_calendar(Trendercontext *rc, TSC_time &disptime, double size)
{
	try{
		QString content,monthstring;

		monthnames->get(disptime.G_month()-1)->tostring(monthstring,0);

		FormatString(content,_qstr("^1 "),disptime.G_day());
		content+=_TRL(monthstring);

		render_exec_string(rc,content);
	}
	catch(QError &)
	{
		throw QError(_text("Error while constructing calendar info"));
	}
}
コード例 #3
0
int python_call_function(void)
{
    if( !python_is_initialised_check() )
        return 0;

    if( check_args( 1, 1+EmacsPythonCallCommand::MAX_ARGS ) )
        return 0;

    EmacsPythonCallCommand py_command;
    if( !string_arg( 1 ) )
        return 0;

    py_command.python_function = ml_value.asString();

    const int first_arg = 2;
    py_command.num_args = cur_exec->p_nargs - 1;
    for( int arg=first_arg; !ml_err && arg<=cur_exec->p_nargs; arg++ )
    {
        if( !eval_arg( arg ) )
            return 0;

        switch( ml_value.exp_type() )
        {
        case ISINTEGER:
        case ISSTRING:
            py_command.python_args[ arg - first_arg ] = ml_value;
            break;

        case ISVOID:
        case ISMARKER:
        case ISWINDOWS:
        case ISARRAY:
            error( FormatString("Python-call - unsupported expression type for arg %d") << arg );
            return 0;
        }
    }

    py_command.executeCommand();

    if( py_command.failed() )
        error( py_command.failureReason() );
    else
        ml_value = py_command.getResult();

    return 0;
}
コード例 #4
0
ファイル: debug.cpp プロジェクト: AOSC-Dev/Pale-Moon
static void output(bool traceInDebugOnly, DebugTraceOutputType outputType, const char *format, va_list vararg)
{
#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
    static std::vector<char> buffer(512);

    if (perfActive())
    {
        size_t len = FormatStringIntoVector(format, vararg, buffer);
        std::wstring formattedWideMessage(buffer.begin(), buffer.begin() + len);

        switch (outputType)
        {
            case DebugTraceOutputTypeNone:
                break;
            case DebugTraceOutputTypeBeginEvent:
                g_DebugAnnotationWrapper->beginEvent(formattedWideMessage);
                break;
            case DebugTraceOutputTypeSetMarker:
                g_DebugAnnotationWrapper->setMarker(formattedWideMessage);
                break;
        }
    }
#endif // ANGLE_ENABLE_DEBUG_ANNOTATIONS

#if defined(ANGLE_ENABLE_DEBUG_TRACE)
#if defined(NDEBUG)
    if (traceInDebugOnly)
    {
        return;
    }
#endif // NDEBUG
    std::string formattedMessage = FormatString(format, vararg);

    static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
    if (file)
    {
        file.write(formattedMessage.c_str(), formattedMessage.length());
        file.flush();
    }

#if defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
    OutputDebugStringA(formattedMessage.c_str());
#endif // ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER

#endif // ANGLE_ENABLE_DEBUG_TRACE
}
コード例 #5
0
bool C4Network2IRCClient::OnConn(const C4NetIO::addr_t &AddrPeer, const C4NetIO::addr_t &AddrConnect, const addr_t *pOwnAddr, C4NetIO *pNetIO)
	{
	// Security checks
	if(!fConnecting || fConnected || !AddrEqual(AddrConnect, ServerAddr)) return false;
	CStdLock Lock(&CSec);
	// Save connection data
	fConnected = true;
	fConnecting = false;
	C4Network2IRCClient::PeerAddr = AddrPeer;
	// Send welcome message
	if(!Password.isNull())
		Send("PASS", Password.getData());
	Send("NICK", Nick.getData());
	Send("USER", FormatString("clonk x x :%s", RealName.getData()).getData());
	// Okay
	return true;
	}
コード例 #6
0
C4Value C4Effect::DoCall(C4PropList *pObj, const char *szFn, const C4Value &rVal1, const C4Value &rVal2, const C4Value &rVal3, const C4Value &rVal4, const C4Value &rVal5, const C4Value &rVal6, const C4Value &rVal7)
{
	C4PropList * p = GetCallbackScript();
	if (!p)
	{
		C4AulFunc * fn = GetFunc(szFn);
		if (fn) return fn->Exec(this, &C4AulParSet(rVal1, rVal2, rVal3, rVal4, rVal5, rVal6, rVal7));
	}
	else
	{
		// old variant
		// compose function name
		C4AulFunc * fn = p->GetFunc(FormatString(PSF_FxCustom, GetName(), szFn).getData());
		if (fn) return fn->Exec(p, &C4AulParSet(Obj(pObj), this, rVal1, rVal2, rVal3, rVal4, rVal5, rVal6, rVal7));
	}
	return C4Value();
}
コード例 #7
0
ファイル: CaptureStream.cpp プロジェクト: PlusChie/CodeXL
void CapturedAPICalls::PlayOverride(CaptureOverride* pCO)
{
    unsigned int i = 0;

    try
    {
        for (CaptureList::iterator iter = m_captureList.begin(); iter != m_captureList.end(); ++iter)
        {
            (*iter)->PlayOverride(pCO);
            ++i;
        }
    }
    catch (...)
    {
        OSWrappers::MessageBox(FormatString("Exception on %i", i).c_str(), (const char*)"exception!", 0);
    }
}
コード例 #8
0
ファイル: C4MessageInput.cpp プロジェクト: ev1313/yaC
C4GUI::Edit::InputResult C4ChatInputDialog::OnChatInput(C4GUI::Edit *edt,
                                                        bool fPasting,
                                                        bool fPastingMore) {
  // no double processing
  if (fProcessed) return C4GUI::Edit::IR_CloseDlg;
  // get edit text
  C4GUI::Edit *pEdt = reinterpret_cast<C4GUI::Edit *>(edt);
  char *szInputText = const_cast<char *>(pEdt->GetText());
  // Store to back buffer
  Game.MessageInput.StoreBackBuffer(szInputText);
  // script queried input?
  if (fObjInput) {
    fProcessed = true;
    // check if the target input is still valid
    C4Player *pPlr = Game.Players.Get(iPlr);
    if (!pPlr) return C4GUI::Edit::IR_CloseDlg;
    if (!pPlr->MarkMessageBoardQueryAnswered(pTarget)) {
      // there was no associated query!
      return C4GUI::Edit::IR_CloseDlg;
    }
    // then do a script callback, incorporating the input into the answer
    if (fUppercase) SCapitalize(szInputText);
    StdStrBuf sInput;
    sInput.Copy(szInputText);
    sInput.EscapeString();
    Game.Control.DoInput(
        CID_Script,
        new C4ControlScript(
            FormatString("OnMessageBoardAnswer(Object(%d), %d, \"%s\")",
                         pTarget ? pTarget->Number : 0, iPlr,
                         sInput.getData()).getData()),
        CDT_Decide);
    return C4GUI::Edit::IR_CloseDlg;
  } else
    // reroute to message input class
    Game.MessageInput.ProcessInput(szInputText);
  // safety: message board commands may do strange things
  if (!C4GUI::IsGUIValid() || this != pInstance) return C4GUI::Edit::IR_Abort;
  // select all text to be removed with next keypress
  // just for pasting mode; usually the dlg will be closed now anyway
  pEdt->SelectAll();
  // avoid dlg close, if more content is to be pasted
  if (fPastingMore) return C4GUI::Edit::IR_None;
  fProcessed = true;
  return C4GUI::Edit::IR_CloseDlg;
}
コード例 #9
0
ファイル: GraphicEngine.cpp プロジェクト: muhaos/MHEngine
GraphicEngine::GraphicEngine(Game *game)
{
	this->game = game;
	needSaveScreenShot = false;
	renderWhireFrame = false;	  
	registrateMethods("game");
	blockDebugTexts = false;
	lightingEnabled = true;
	renderFilter = new PlatformerRenderFilter(CVector(500, 400));

#ifndef IPHONE_OS
	GLenum err = glewInit();
	if (GLEW_OK != err) {
	  Log::error(FormatString("Error: %s\n", glewGetErrorString(err)));
	}
#endif
}
コード例 #10
0
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
	struct ProcInfo *pi=(struct ProcInfo *)lParam;
	VMenu2 *ProcList=pi->procList;

	if (IsWindowVisible(hwnd) || (IsIconic(hwnd) && !(GetWindowLongPtr(hwnd,GWL_STYLE) & WS_DISABLED)))
	{
		DWORD ProcID;
		GetWindowThreadProcessId(hwnd,&ProcID);
		string strTitle;

		int LenTitle=GetWindowTextLength(hwnd);
		if (LenTitle)
		{
			if (pi->bShowImage)
			{
				HANDLE hProc = OpenProcess(Global->ifn->QueryFullProcessImageNameWPresent()? PROCESS_QUERY_LIMITED_INFORMATION : PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, false, ProcID);
				if (hProc)
				{
					api::GetModuleFileNameEx(hProc, nullptr, strTitle);
					CloseHandle(hProc);
				}
			}
			else
			{
				wchar_t_ptr Title(LenTitle + 1);
				if (Title)
				{
					if ((LenTitle=GetWindowText(hwnd, Title.get(), LenTitle+1)))
						Title[LenTitle]=0;
					else
						Title[0]=0;
					strTitle=Title.get();
				}
			}
		}
		if (!strTitle.empty())
		{
			ProcList->SetUserData(&hwnd,sizeof(hwnd),ProcList->AddItem(FormatString()<<fmt::MinWidth(PID_LENGTH)<<ProcID<< L' ' << BoxSymbols[BS_V1]<< L' ' << strTitle));
		}

	}

	return TRUE;
}
コード例 #11
0
ファイル: C4FileSelDlg.cpp プロジェクト: ev1313/yaC
C4PortraitSelDlg::C4PortraitSelDlg(C4FileSel_BaseCB *pSelCallback,
                                   bool fSetPicture, bool fSetBigIcon)
    : C4FileSelDlg(Config.General.ExePath,
                   FormatString(LoadResStr("IDS_MSG_SELECT"),
                                LoadResStr("IDS_TYPE_PORTRAIT")).getData(),
                   pSelCallback, false),
      pCheckSetPicture(NULL),
      pCheckSetBigIcon(NULL),
      fDefSetPicture(fSetPicture),
      fDefSetBigIcon(fSetBigIcon) {
  char path[_MAX_PATH + 1];
  // add common picture locations
  StdStrBuf strLocation;
  SCopy(Config.AtUserPath(""), path, _MAX_PATH);
  TruncateBackslash(path);
  strLocation.Format("%s %s", C4ENGINECAPTION, LoadResStr("IDS_TEXT_USERPATH"));
  AddLocation(strLocation.getData(), path);
  SCopy(Config.AtExePath(""), path, _MAX_PATH);
  TruncateBackslash(path);
  strLocation.Format("%s %s", C4ENGINECAPTION,
                     LoadResStr("IDS_TEXT_PROGRAMDIRECTORY"));
  AddCheckedLocation(strLocation.getData(), Config.General.ExePath);
#ifdef _WIN32
  if (SHGetSpecialFolderPath(NULL, path, CSIDL_PERSONAL, FALSE))
    AddCheckedLocation(LoadResStr("IDS_TEXT_MYDOCUMENTS"), path);
  if (SHGetSpecialFolderPath(NULL, path, CSIDL_MYPICTURES, FALSE))
    AddCheckedLocation(LoadResStr("IDS_TEXT_MYPICTURES"), path);
  if (SHGetSpecialFolderPath(NULL, path, CSIDL_DESKTOPDIRECTORY, FALSE))
    AddCheckedLocation(LoadResStr("IDS_TEXT_DESKTOP"), path);
#endif
#ifdef __APPLE__
  AddCheckedLocation(LoadResStr("IDS_TEXT_HOME"), getenv("HOME"));
#else
  AddCheckedLocation(LoadResStr("IDS_TEXT_HOMEFOLDER"), getenv("HOME"));
#endif
#ifndef _WIN32
  sprintf(path, "%s%c%s", getenv("HOME"), (char)DirectorySeparator,
          (const char *)"Desktop");
  AddCheckedLocation(LoadResStr("IDS_TEXT_DESKTOP"), path);
#endif
  // build dialog
  InitElements();
  // select last location
  SetCurrentLocation(Config.Startup.LastPortraitFolderIdx, false);
}
コード例 #12
0
ファイル: C4Shader.cpp プロジェクト: 772/openclonk
bool C4Shader::Refresh(const char *szWhat, const char **szUniforms)
{
	// Find a slice where the source file has updated
	ShaderSliceList::iterator pSlice;
	for (pSlice = FragmentSlices.begin(); pSlice != FragmentSlices.end(); pSlice++)
		if (pSlice->Source.getLength() &&
			FileExists(pSlice->Source.getData()) &&
			FileTime(pSlice->Source.getData()) > pSlice->SourceTime)
			break;
	if (pSlice == FragmentSlices.end()) return true;
	StdCopyStrBuf Source = pSlice->Source;

	// Okay, remove all slices that came from this file
	ShaderSliceList::iterator pNext;
	for (; pSlice != FragmentSlices.end(); pSlice = pNext)
	{
		pNext = pSlice; pNext++;
		if (SEqual(pSlice->Source.getData(), Source.getData()))
			FragmentSlices.erase(pSlice);
	}

	// Load new shader
	char szParentPath[_MAX_PATH+1]; C4Group Group;
	StdStrBuf Shader;
	GetParentPath(Source.getData(),szParentPath);
	if(!Group.Open(szParentPath) ||
	   !Group.LoadEntryString(GetFilename(Source.getData()),&Shader) ||
	   !Group.Close())
	{
		ShaderLogF("  gl: Failed to refresh %s shader from %s!", szWhat, Source.getData());
		return Refresh(szWhat, szUniforms);
	}

	// Load slices
	int iSourceTime = FileTime(Source.getData());
	StdStrBuf WhatSrc = FormatString("file %s", Config.AtRelativePath(Source.getData()));
	AddFragmentSlices(WhatSrc.getData(), Shader.getData(), Source.getData(), iSourceTime);

	// Reinitialise
	if (!Init(szWhat, szUniforms))
		return false;

	// Retry
	return Refresh(szWhat, szUniforms);
}
コード例 #13
0
bool C4PlayerList::RemoveLocal(bool fDisconnect, bool fNoCalls)
{
	// (used by league system the set local fate)
	C4Player *pPlr;
	do
		for (pPlr = First; pPlr; pPlr = pPlr->Next)
			if (pPlr->LocalControl)
			{
				// Log
				Log(FormatString(LoadResStr("IDS_PRC_REMOVEPLR"),pPlr->GetName()).getData());
				// Remove
				Remove(pPlr, fDisconnect, fNoCalls);
				break;
			}
	while (pPlr);

	return true;
}
コード例 #14
0
ファイル: search.cpp プロジェクト: barry-scott/BarrysEmacs
int re_search_reverse_helper( EmacsSearch::sea_type RE )
{
    int np;
    EmacsString str;
    if( arg <= 0 )
        arg = 1;
    if( RE == EmacsSearch::sea_type__RE_extended )
        str = getstr("Reverse ERE search for: ");
    else
        str = getstr("Reverse RE search for: ");
    np = sea_glob.search( str, -arg, dot, RE );
    if( np == 0 && ! ml_err )
        error(FormatString("Cannot find \"%s\"") << last_search_string.asString() );
    else
        if( np > 0 )
            set_dot( np );
    return 0;
}
コード例 #15
0
ファイル: simpcomm.cpp プロジェクト: barry-scott/BarrysEmacs
int erase_region( void )
{
    if( !bf_cur->b_mark.isSet() )
        error( FormatString(no_mark_set_str) << bf_cur->b_buf_name);
    else
    {
        int n = bf_cur->b_mark.to_mark() - dot;

        if( n < 0 )
        {
            n = -n;
            dot_left (n);
        }
        bf_cur->del_frwd( dot, n );
    }

    return 0;
}
コード例 #16
0
ファイル: simpcomm.cpp プロジェクト: barry-scott/BarrysEmacs
static int left_or_right_marker( int right )
{
    if( !eval_arg( 1 ) )
        return 0;

    if( ml_value.exp_type() != ISMARKER )
    {
        error( FormatString("%s expects its argument to be a marker") <<
            cur_exec->p_proc->b_proc_name );
        return 0;
    }

    int n = ml_value.asMarker()->get_mark();
    Marker *m = EMACS_NEW Marker( bf_cur, n, right );
    ml_value = m;

    return 0;
}
コード例 #17
0
	TEXTURE_ADDRESS_MODE AddressModeFromString(const char* sz)
	{
		if (!sz)
			return TEXTURE_ADDRESS_CLAMP;
		if (_stricmp(sz, "Wrap") == 0)
			return TEXTURE_ADDRESS_WRAP;
		if (_stricmp(sz, "Mirror") == 0)
			return TEXTURE_ADDRESS_MIRROR;
		if (_stricmp(sz, "Clamp") == 0)
			return TEXTURE_ADDRESS_CLAMP;
		if (_stricmp(sz, "Border") == 0)
			return TEXTURE_ADDRESS_BORDER;
		if (_stricmp(sz, "Mirror_Once") == 0)
			return TEXTURE_ADDRESS_MIRROR_ONCE;

		Logger::Log(FB_ERROR_LOG_ARG, FormatString("%s is not valid TEXTURE_ADDRESS_MODE", sz).c_str());
		return TEXTURE_ADDRESS_CLAMP;
	}
コード例 #18
0
QLineEdit *C4ConsoleQtLocalizeStringDlg::AddEditor(const char *language, const char *language_name)
{
	assert(!GetEditorByLanguage(language));
	// Add editor widgets
	int32_t row = edited_languages.size();
	QString language_label_text(language);
	if (language_name) language_label_text.append(FormatString(" (%s)", language_name).getData());
	QLabel *language_label = new QLabel(language_label_text, this);
	ui.mainGrid->addWidget(language_label, row, 0);
	QLineEdit *value_editor = new QLineEdit(this);
	ui.mainGrid->addWidget(value_editor, row, 1);
	// Add to list
	EditedLanguage new_editor;
	SCopy(language, new_editor.language, 2);
	new_editor.value_editor = value_editor;
	edited_languages.push_back(new_editor);
	return value_editor;
}
コード例 #19
0
ファイル: display.cpp プロジェクト: barry-scott/BarrysEmacs
void EmacsView::moveLine
    (
    int old_line_num,
    int new_line_num
    )
{
#if DBG_CALC_INS_DEL
    if( dbg_flags&DBG_CALC_INS_DEL )
    {
        const EmacsChar_t nul( 0 );
        EmacsLinePtr &old_line = t_phys_screen[ old_line_num ];
        EmacsLinePtr &new_line = t_desired_screen[ new_line_num ];

        const int dump_size = 30;
        const EmacsChar_t *old_line_start = &nul;
        int old_line_len = 0;
        if( !old_line.isNull() )
        {
            old_line_start = old_line->line_body;
            old_line_len = old_line->line_length;
        }
        const EmacsChar_t *new_line_start = &nul;
        int new_line_len = 0;
        if( !new_line.isNull() )
        {
            new_line_start = new_line->line_body;
            new_line_len = new_line->line_length;
        }

        _dbg_msg( FormatString( "         moveLine( Ln:%2d Sz%3d:'%.*s'%*s, Ln:%2d Sz%3d:'%.*s'%*s )" )
            << old_line_num
            << old_line_len
                << std::min( old_line_len, dump_size ) << old_line_start
                    << std::max( dump_size-old_line_len, 0 ) << ""
            << new_line_num
            << new_line_len
                << std::min( new_line_len, dump_size ) << new_line_start
                    << std::max( dump_size-new_line_len, 0 ) << ""
            );
    }
#endif

    t_move_line( old_line_num, new_line_num );
}
コード例 #20
0
	TEXTURE_FILTER FilterFromString(const char* sz)
	{
		if (!sz)
			return TEXTURE_FILTER_MIN_MAG_MIP_LINEAR;
		if (_stricmp(sz, "MIN_MAG_MIP_POINT") == 0)
			return TEXTURE_FILTER_MIN_MAG_MIP_POINT;
		if (_stricmp(sz, "MIN_MAG_POINT_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_MIN_MAG_POINT_MIP_LINEAR;
		if (_stricmp(sz, "MIN_POINT_MAG_LINEAR_MIP_POINT") == 0)
			return TEXTURE_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT;
		if (_stricmp(sz, "MIN_POINT_MAG_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_MIN_POINT_MAG_MIP_LINEAR;
		if (_stricmp(sz, "MIN_LINEAR_MAG_MIP_POINT") == 0)
			return TEXTURE_FILTER_MIN_LINEAR_MAG_MIP_POINT;
		if (_stricmp(sz, "MIN_LINEAR_MAG_POINT_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
		if (_stricmp(sz, "MIN_MAG_LINEAR_MIP_POINT") == 0)
			return TEXTURE_FILTER_MIN_MAG_LINEAR_MIP_POINT;
		if (_stricmp(sz, "MIN_MAG_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_MIN_MAG_MIP_LINEAR;
		if (_stricmp(sz, "ANISOTROPIC") == 0)
			return TEXTURE_FILTER_ANISOTROPIC;
		if (_stricmp(sz, "COMPARISON_MIN_MAG_MIP_POINT") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_MAG_MIP_POINT;
		if (_stricmp(sz, "COMPARISON_MIN_MAG_POINT_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR;
		if (_stricmp(sz, "COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT;
		if (_stricmp(sz, "COMPARISON_MIN_POINT_MAG_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR;
		if (_stricmp(sz, "COMPARISON_MIN_LINEAR_MAG_MIP_POINT") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT;
		if (_stricmp(sz, "COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
		if (_stricmp(sz, "COMPARISON_MIN_MAG_LINEAR_MIP_POINT") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
		if (_stricmp(sz, "COMPARISON_MIN_MAG_MIP_LINEAR") == 0)
			return TEXTURE_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR;
		if (_stricmp(sz, "COMPARISON_ANISOTROPIC") == 0)
			return TEXTURE_FILTER_COMPARISON_ANISOTROPIC;

		Logger::Log(FB_ERROR_LOG_ARG, FormatString("%s is not vaild TEXTURE_FILTER", sz).c_str());
		return TEXTURE_FILTER_MIN_MAG_MIP_LINEAR;
	}
コード例 #21
0
ファイル: set_prop.cpp プロジェクト: bagdxk/openafs
void Filesets_ShowProperties (LPIDENT lpiFileset, size_t nAlerts, BOOL fJumpToThreshold)
{
   HWND hCurrent;
   if ((hCurrent = PropCache_Search (pcSET_PROP, lpiFileset)) != NULL)
      {
      SetFocus (hCurrent);

      if (fJumpToThreshold)
         {
         HWND hTab;
         if ((hTab = GetDlgItem (hCurrent, IDC_PROPSHEET_TABCTRL)) != NULL)
            {
            int nTabs = TabCtrl_GetItemCount (hTab);
            TabCtrl_SetCurSel (hTab, nTabs-1);

            NMHDR nm;
            nm.hwndFrom = hTab;
            nm.idFrom = IDC_PROPSHEET_TABCTRL;
            nm.code = TCN_SELCHANGE;
            SendMessage (hCurrent, WM_NOTIFY, 0, (LPARAM)&nm);
            }
         }
      }
   else
      {
      TCHAR szCell[ cchNAME ];
      lpiFileset->GetCellName (szCell);

      TCHAR szFileset[ cchNAME ];
      lpiFileset->GetFilesetName (szFileset);

      LPTSTR pszTitle = FormatString (IDS_SET_PROP_TITLE, TEXT("%s"), szFileset);
      LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE);
      psh->fMadeCaption = TRUE;

      if (PropSheet_AddProblemsTab (psh, IDD_SET_PROBLEMS, lpiFileset, nAlerts) &&
          PropSheet_AddTab (psh, IDS_SET_GENERAL_TAB, IDD_SET_GENERAL, (DLGPROC)Filesets_General_DlgProc, (LPARAM)lpiFileset, TRUE))
         {
         if (fJumpToThreshold)
            psh->sh.nStartPage = psh->sh.nPages-1;
         PropSheet_ShowModeless (psh);
         }
      }
}
コード例 #22
0
void ChangeAddr_OnInitDialog (HWND hDlg, LPSVR_CHANGEADDR_PARAMS lpp)
{
   TCHAR szName[ cchNAME ];
   lpp->lpiServer->GetServerName (szName);

   TCHAR szText[ cchRESOURCE ];
   GetDlgItemText (hDlg, IDC_TITLE, szText, cchRESOURCE);

   LPTSTR pszTitle = FormatString (szText, TEXT("%s"), szName);
   SetDlgItemText (hDlg, IDC_TITLE, pszTitle);
   FreeString (pszTitle);

   HWND hList = GetDlgItem (hDlg, IDC_SVR_ADDRESSES);
   LB_StartChange (hList, TRUE);
   LB_AddItem (hList, IDS_QUERYING, 0);
   LB_EndChange (hList, 0);

   ChangeAddr_Enable (hDlg, FALSE);
}
コード例 #23
0
ファイル: set_release.cpp プロジェクト: chanke/openafs-osd
void Filesets_Release_OnInitDialog (HWND hDlg, LPIDENT lpi)
{
   TCHAR szServer[ cchNAME ];
   TCHAR szAggregate[ cchNAME ];
   TCHAR szFileset[ cchNAME ];
   lpi->GetServerName (szServer);
   lpi->GetAggregateName (szAggregate);
   lpi->GetFilesetName (szFileset);

   TCHAR szOld[ cchRESOURCE ];
   GetDlgItemText (hDlg, IDC_RELSET_DESC, szOld, cchRESOURCE);

   LPTSTR pszText = FormatString (szOld, TEXT("%s%s%s"), szServer, szAggregate, szFileset);
   SetDlgItemText (hDlg, IDC_RELSET_DESC, pszText);
   FreeString (pszText);

   CheckDlgButton (hDlg, IDC_RELSET_NORMAL, TRUE);
   CheckDlgButton (hDlg, IDC_RELSET_FORCE, FALSE);
}
コード例 #24
0
ファイル: rle.c プロジェクト: xorgy/graphicsmagick
static unsigned int
RLEConstrainColormapIndex(Image *image, unsigned int index,
                          unsigned int colormap_entries)
{
    if (index >= colormap_entries)
    {
        char
        colormapIndexBuffer[MaxTextExtent];

        FormatString(colormapIndexBuffer,"index %u >= %u, %.1024s",
                     (unsigned int) index, colormap_entries, image->filename);
        errno=0;
        index=0U;
        ThrowException(&image->exception,CorruptImageError,
                       InvalidColormapIndex,colormapIndexBuffer);
    }

    return index;
}
コード例 #25
0
ファイル: taskmethod.cpp プロジェクト: BeatlesCoder/behaviac
    void CTaskMethod::SetTaskParams(behaviac::Agent* pAgent)
    {
        if (this->m_paramTypes.size() > 0)
        {
            BEHAVIAC_ASSERT(this->m_paramTypes.size() == this->m_params.size());
            const char* agentType = pAgent->GetObjectTypeName();

            AgentProperties* agentT = AgentProperties::Get(agentType);

            for (uint32_t i = 0; i < this->m_paramTypes.size(); ++i)
            {
                behaviac::Property* valueProperty = this->m_params[i];
                BEHAVIAC_ASSERT(valueProperty);

                behaviac::string paramName = FormatString("%s%d", BEHAVIAC_LOCAL_TASK_PARAM_PRE, i);
                this->SetTaskParam(pAgent, agentT, paramName.c_str(), valueProperty);
            }
        }
    }
コード例 #26
0
ファイル: architecture.cpp プロジェクト: anat/medusa
MEDUSA_NAMESPACE_BEGIN

  bool Architecture::FormatCell(
  Document      const& rDoc,
  BinaryStream  const& rBinStrm,
  Address       const& rAddr,
  Cell          const& rCell,
  std::string        & rStrCell,
  Cell::Mark::List   & rMarks) const
{
  switch (rCell.GetType())
  {
  case Cell::InstructionType: return FormatInstruction(rDoc, rBinStrm, rAddr, static_cast<Instruction const&>(rCell), rStrCell, rMarks);
  case Cell::ValueType:       return FormatValue      (rDoc, rBinStrm, rAddr, static_cast<Value       const&>(rCell), rStrCell, rMarks);
  case Cell::CharacterType:   return FormatCharacter  (rDoc, rBinStrm, rAddr, static_cast<Character   const&>(rCell), rStrCell, rMarks);
  case Cell::StringType:      return FormatString     (rDoc, rBinStrm, rAddr, static_cast<String      const&>(rCell), rStrCell, rMarks);
  default:                    return false;
  }
}
コード例 #27
0
	CULL_MODE CullModeFromString(const char* str)
	{
		if (!str)
			return CULL_MODE_BACK;
		if (_stricmp(str, "CULL_MODE_NONE") == 0)
		{
			return CULL_MODE_NONE;
		}
		if (_stricmp(str, "CULL_MODE_FRONT") == 0)
		{
			return CULL_MODE_FRONT;
		}
		if (_stricmp(str, "CULL_MODE_BACK") == 0)
		{
			return CULL_MODE_BACK;
		}
		Logger::Log(FB_ERROR_LOG_ARG, FormatString("%s is not vaild CULL_MODE", str).c_str());
		return CULL_MODE_BACK;
	}
コード例 #28
0
	int TextureTypeFromString(const char* str)
	{
		if (!str)
			return TEXTURE_TYPE_DEFAULT;
		if (_stricmp(str, "ColorRamp") == 0)
			return TEXTURE_TYPE_COLOR_RAMP;
		if (_stricmp(str, "Default") == 0)
			return TEXTURE_TYPE_DEFAULT;
		if (_stricmp(str, "RenderTarget") == 0)
			return TEXTURE_TYPE_RENDER_TARGET;
		if (_stricmp(str, "DepthStencil") == 0)
			return TEXTURE_TYPE_DEPTH_STENCIL;
		if (_stricmp(str, "1D") == 0) {
			return TEXTURE_TYPE_DEFAULT | TEXTURE_TYPE_1D;
		}

		Logger::Log(FB_ERROR_LOG_ARG, FormatString("%s is not vaild TEXTURE_TYPE", str).c_str());
		return TEXTURE_TYPE_DEFAULT;
	}
コード例 #29
0
void PostgreSQLInterface::EncodeQueryUpdate(const char *colName, const char *str, RakNet::RakString &valueStr, int &numParams, char **paramData, int *paramLength, int *paramFormat, const char *type)
{
	if (str==0 || str[0]==0)
		return;

	if (valueStr.IsEmpty()==false)
	{
		valueStr += ", ";
	}
	valueStr += colName;
	valueStr+=" = ";
	valueStr+=FormatString("$%i::%s", numParams+1, type);

	paramData[numParams]=(char*) str;
	paramLength[numParams]=(int) strlen(str);

	paramFormat[numParams]=PQEXECPARAM_FORMAT_TEXT;
	numParams++;
}
コード例 #30
0
ファイル: planner.cpp プロジェクト: AdamHyl/behaviac
    void Planner::LogPlanEnd(Agent* a, Task* root)
    {
        BEHAVIAC_UNUSED_VAR(a);
        BEHAVIAC_UNUSED_VAR(root);
#if !BEHAVIAC_RELEASE

        if (Config::IsLoggingOrSocketing())
        {
            behaviac::string agentClassName(a->GetObjectTypeName());
            behaviac::string agentInstanceName(a->GetName());

            behaviac::string ni = BehaviorTask::GetTickInfo(a, root, NULL);
            behaviac::string buffer = FormatString("[plan_end]%s#%s %s\n", agentClassName.c_str(), agentInstanceName.c_str(), ni.c_str());

            LogManager::GetInstance()->Log(buffer.c_str());
        }

#endif
    }