void cbEditorPanel::UpdateModified()
{
    if ( GetModified() )
        SetTitle( _T("*") + GetShortName() );
    else
        SetTitle( GetShortName() );
}
Exemple #2
0
void wxsItemEditor::UpdateModified()
{
    if ( m_Data && m_Data->GetModified() )
    {
        SetTitle(_T("*") + GetShortName());
    }
    else
    {
        SetTitle(GetShortName());
    }
}
Exemple #3
0
/** Update the Window title with a '*' char if the file is modified
  */
void XPMEditorBase::UpdateModified(void)
{
    if (GetModified())
    {
        SetTitle(_T("*") + GetShortName());
    }
    else
    {
        SetTitle(GetShortName());
    }
}
void PHPEntityVariable::PrintStdout(int indent) const
{
    wxString indentString(' ', indent);
    wxPrintf("%s%s: %s", indentString, IsMember() ? "Member" : "Variable", GetShortName());
    if(!GetTypeHint().IsEmpty()) {
        wxPrintf(", TypeHint: %s", GetTypeHint());
    }
    if(!GetExpressionHint().IsEmpty()) {
        wxPrintf(", ExpressionHint: %s", GetExpressionHint());
    }
    if(IsReference()) {
        wxPrintf(", Reference");
    }
    if(!GetDefaultValue().IsEmpty()) {
        wxPrintf(", Default: %s", GetDefaultValue());
    }

    wxPrintf(", Ln. %d", GetLine());
    wxPrintf("\n");

    PHPEntityBase::List_t::const_iterator iter = m_children.begin();
    for(; iter != m_children.end(); ++iter) {
        (*iter)->PrintStdout(indent + 4);
    }
}
void PHPEntityVariable::Store(wxSQLite3Database& db)
{
    // we keep only the function arguments in the databse and globals
    if(IsFunctionArg() || IsMember()) {
        try {
            wxSQLite3Statement statement =
                db.PrepareStatement("INSERT OR REPLACE INTO VARIABLES_TABLE VALUES (NULL, "
                                    ":SCOPE_ID, :FUNCTION_ID, :NAME, :FULLNAME, :SCOPE, :TYPEHINT, "
                                    ":FLAGS, :DOC_COMMENT, :LINE_NUMBER, :FILE_NAME)");
            statement.Bind(statement.GetParamIndex(":SCOPE_ID"), IsMember() ? Parent()->GetDbId() : wxLongLong(-1));
            statement.Bind(statement.GetParamIndex(":FUNCTION_ID"),
                           IsFunctionArg() ? Parent()->GetDbId() : wxLongLong(-1));
            statement.Bind(statement.GetParamIndex(":NAME"), GetShortName());
            statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName());
            statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope());
            statement.Bind(statement.GetParamIndex(":TYPEHINT"), GetTypeHint());
            statement.Bind(statement.GetParamIndex(":FLAGS"), (int)GetFlags());
            statement.Bind(statement.GetParamIndex(":DOC_COMMENT"), GetDocComment());
            statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine());
            statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath());
            statement.ExecuteUpdate();
            SetDbId(db.GetLastRowId());

        } catch(wxSQLite3Exception& exc) {
            wxUnusedVar(exc);
        }
    }
}
Exemple #6
0
static int get_username() {
	
	IEnumWbemClassObject *enumerator = 0;
	IWbemClassObject * object = 0;

	bool res = false;
	_username = bstr_t();
	enumerator = request(bstr_t("select UserName from Win32_ComputerSystem"));

	VARIANT vUsername;
	VariantInit(&vUsername);

	ULONG uReturn;
	for(;;) {
		HRESULT result = enumerator->Next(WBEM_INFINITE, 1, &object, &uReturn);
		if(uReturn == 0) {
			break;
		}
		result = object->Get(L"UserName", 0, &vUsername, 0, 0);

		if (SUCCEEDED(result)) {
			_username = GetShortName(vUsername.bstrVal);
			res = true;
		}
		object->Release();
	}

	if (enumerator)
		enumerator->Release();

	//std::cout << "get_username(): " << _username << std::endl;

	return res;
}
Exemple #7
0
void CodeliteVim::CreatePluginMenu(wxMenu* pluginsMenu)
{
    wxMenu* menu = new wxMenu();
    menu->Append(new wxMenuItem(menu, XRCID("vim_settings"), _("Settings...")));
    pluginsMenu->Append(wxID_ANY, GetShortName(), menu);
    wxTheApp->Bind(wxEVT_MENU, &CodeliteVim::onVimSetting, this, XRCID("vim_settings"));
}
void PHPEntityClass::Store(wxSQLite3Database& db)
{
    try {
        wxSQLite3Statement statement =
            db.PrepareStatement("REPLACE INTO SCOPE_TABLE (ID, SCOPE_TYPE, SCOPE_ID, NAME, FULLNAME, EXTENDS, "
                                "IMPLEMENTS, USING_TRAITS, FLAGS, DOC_COMMENT, "
                                "LINE_NUMBER, FILE_NAME) VALUES (NULL, 1, :SCOPE_ID, :NAME, :FULLNAME, :EXTENDS, "
                                ":IMPLEMENTS, :USING_TRAITS, :FLAGS, :DOC_COMMENT, :LINE_NUMBER, :FILE_NAME)");

        statement.Bind(statement.GetParamIndex(":SCOPE_ID"), Parent()->GetDbId());
        statement.Bind(statement.GetParamIndex(":NAME"), GetShortName());
        statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName());
        statement.Bind(statement.GetParamIndex(":EXTENDS"), GetExtends());
        statement.Bind(statement.GetParamIndex(":IMPLEMENTS"), GetImplementsAsString());
        statement.Bind(statement.GetParamIndex(":USING_TRAITS"), GetTraitsAsString());
        statement.Bind(statement.GetParamIndex(":FLAGS"), (int) GetFlags());
        statement.Bind(statement.GetParamIndex(":DOC_COMMENT"), GetDocComment());
        statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine());
        statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath());
        statement.ExecuteUpdate();
        SetDbId(db.GetLastRowId());
    } catch(wxSQLite3Exception& exc) {
        wxUnusedVar(exc);
    }
}
SkirmishAIKey CSkirmishAILibraryInfo::GetKey() const {

	const std::string& sn = GetShortName();
	const std::string& v = GetVersion();
	SkirmishAIKey key = SkirmishAIKey(sn, v);

	return key;
}
Exemple #10
0
void WordCompletionPlugin::CreatePluginMenu(wxMenu* pluginsMenu)
{
    wxMenu* menu = new wxMenu;
    menu->Append(XRCID("text_word_complete"), _("Show Word Completion"));
    menu->AppendSeparator();
    menu->Append(XRCID("text_word_complete_settings"), _("Settings"));
    pluginsMenu->Append(wxID_ANY, GetShortName(), menu);
}
Exemple #11
0
const std::string& GameFile::GetName(bool long_name) const
{
  const std::string& name = long_name ? GetLongName() : GetShortName();
  if (!name.empty())
    return name;

  // No usable name, return filename (better than nothing)
  return m_file_name;
}
wxString PHPEntityVariable::GetNameNoDollar() const
{
    wxString name = GetShortName();
    if(name.StartsWith("$")) {
        name.Remove(0, 1);
    }
    name.Trim().Trim(false);
    return name;
}
Exemple #13
0
const char *plResponderCmdAnim::GetInstanceName(IParamBlock2 *pb)
{
    static char name[256];

    const char *shortName = GetShortName(pb->GetInt(kRespAnimType));
    plMaxNode *node = (plMaxNode*)pb->GetReferenceTarget(kRespAnimComp);
    sprintf(name, "%s (%s)", shortName, node ? node->GetName() : "none");

    return name;
}
Exemple #14
0
void
IRShaderParam::WriteDecl(std::ostream& out, unsigned int indent) const
{
    out << std::setw(indent) << "";
    if (IsOutput())
        out << "output ";
    out << IRDetailToString(GetDetail()) << " "
        << *GetType() << " " 
        << GetShortName();
    IRStmt* init = GetInitStmt();
    assert(init != NULL && "Initializer should never be NULL");
    if (!init->IsEmpty()) {
        out << " = ";
        init->WriteInit(out, this, indent+4);
    }
}
Exemple #15
0
void LogManager::LogWithFullPath(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
                                 const char* file, int line, const char* format, va_list args)
{
  if (!IsEnabled(type, level) || !static_cast<bool>(m_listener_ids))
    return;

  char temp[MAX_MSGLEN];
  CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);

  std::string msg =
      StringFromFormat("%s %s:%u %c[%s]: %s\n", Common::Timer::GetTimeFormatted().c_str(), file,
                       line, LogTypes::LOG_LEVEL_TO_CHAR[(int)level], GetShortName(type), temp);

  for (auto listener_id : m_listener_ids)
    if (m_listeners[listener_id])
      m_listeners[listener_id]->Log(level, msg.c_str());
}
Exemple #16
0
void PHPEntityNamespace::Store(PHPLookupTable* lookup)
{
    try {
        // A namespace, unlike other PHP entities, can be defined in various files
        // and in multiple locations. This means, that by definition, there can be multiple entries
        // for the same namespace, however, since our relations in the database is ID based,
        // we try to locate the namespace in the DB before we attempt to insert it
        wxSQLite3Database& db = lookup->Database();
        {
            wxSQLite3Statement statement =
                db.PrepareStatement("SELECT * FROM SCOPE_TABLE WHERE FULLNAME=:FULLNAME LIMIT 1");
            statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName());
            wxSQLite3ResultSet res = statement.ExecuteQuery();
            if(res.NextRow()) {
                // we have a match, update this item database ID to match
                // what we have found in the database
                PHPEntityNamespace ns;
                ns.FromResultSet(res);
                SetDbId(ns.GetDbId());
                return;
            }
        }

        // Get the 'parent' namespace part
        wxString parentPath = GetFullName().BeforeLast('\\');
        DoEnsureNamespacePathExists(db, parentPath);

        {
            wxSQLite3Statement statement = db.PrepareStatement(
                "INSERT INTO SCOPE_TABLE (ID, SCOPE_TYPE, SCOPE_ID, NAME, FULLNAME, LINE_NUMBER, FILE_NAME) "
                "VALUES (NULL, 0, -1, :NAME, :FULLNAME, :LINE_NUMBER, :FILE_NAME)");
            statement.Bind(statement.GetParamIndex(":NAME"), GetShortName());
            statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName());
            statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine());
            statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath());
            statement.ExecuteUpdate();
            SetDbId(db.GetLastRowId());
        }
    } catch(wxSQLite3Exception& exc) {
        wxUnusedVar(exc);
    }
}
void PHPEntityFunctionAlias::Store(wxSQLite3Database& db)
{
    try {
        wxSQLite3Statement statement = db.PrepareStatement(
                                           "INSERT OR REPLACE INTO FUNCTION_ALIAS_TABLE VALUES(NULL, :SCOPE_ID, :NAME, :REALNAME, :FULLNAME, :SCOPE, "
                                           ":LINE_NUMBER, :FILE_NAME)");
        statement.Bind(statement.GetParamIndex(":SCOPE_ID"), Parent()->GetDbId());
        statement.Bind(statement.GetParamIndex(":NAME"), GetShortName());
        statement.Bind(statement.GetParamIndex(":REALNAME"), GetRealname());
        statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName());
        statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope());
        statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine());
        statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath());
        statement.ExecuteUpdate();
        SetDbId(db.GetLastRowId());

    } catch(wxSQLite3Exception& exc) {
        CL_WARNING("PHPEntityFunctionAlias::Store: %s", exc.GetMessage());
    }
}
void ExternalToolsPlugin::DoRecreateToolbar()
{
	wxWindow *parent(NULL);
	if (m_tb) {
		// we have a toolbar, remove it from the docking manager
		m_mgr->GetDockingManager()->DetachPane(m_tb);
		parent = m_tb->GetParent();
		m_tb->Destroy();
	} else {
		parent = m_mgr->GetTheApp()->GetTopWindow();
	}

	m_tb = CreateToolBar(parent);
	if (m_tb) {
		m_mgr->GetDockingManager()->AddPane(m_tb, wxAuiPaneInfo().Name(GetShortName()).LeftDockable( true ).RightDockable( true ).Caption(GetShortName()).ToolbarPane().Top() );

		// Apply changes
		m_mgr->GetDockingManager()->Update();
	}
}
wxString PHPEntityVariable::ToFuncArgString() const
{
    if(!IsFunctionArg()) {
        return "";
    }

    wxString str;
    if(!GetTypeHint().IsEmpty()) {
        str << GetTypeHint() << " ";
    }

    if(IsReference()) {
        str << "&";
    }

    str << GetShortName();
    if(!GetDefaultValue().IsEmpty()) {
        str << " = " << GetDefaultValue();
    }
    return str;
}
int CGXDLMSAssociationShortName::GetValue(int index, unsigned char* parameters, int length, CGXDLMSVariant& value)
{
	if (index == 1)
	{
		GXHelpers::AddRange(value.byteArr, m_LN, 6);
		value.vt = DLMS_DATA_TYPE_OCTET_STRING;
		return ERROR_CODES_OK;
	}
	if (index == 2)
	{
		vector<unsigned char> Packets;
		int ret = GetObjects(Packets);
		value = Packets;
		return ret;
	}
	if (index == 3)
	{
		bool lnExists = m_ObjectList.FindBySN(GetShortName()) != NULL;
        //Add count        
        int cnt = m_ObjectList.size();
        if (!lnExists)
        {
            ++cnt;
        }            
        vector<unsigned char> data;
        data.push_back(DLMS_DATA_TYPE_ARRAY);
        CGXOBISTemplate::SetObjectCount(cnt, data);
		for(vector<CGXDLMSObject*>::iterator it = m_ObjectList.begin(); it != m_ObjectList.end(); ++it)
        {
            GetAccessRights(*it, data);
        }
        if (!lnExists)
        {
            GetAccessRights(this, data);
        }
        value = data;
	}
	return ERROR_CODES_INVALID_PARAMETER;
}
wxString PHPEntityFunctionAlias::GetDisplayName() const {
    return GetShortName();
}
Exemple #22
0
FString FPackageName::GetShortName(const TCHAR* LongName)
{
	return GetShortName(FString(LongName));
}
Exemple #23
0
FString FPackageName::GetShortName(const FName& LongName)
{
	return GetShortName(LongName.ToString());
}
Exemple #24
0
FString FPackageName::GetShortName(UPackage* Package)
{
	check(Package != NULL);
	return GetShortName(Package->GetName());
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pDC - 
//			rect - 
//			iFontHeight - 
//			dwFlags - 
//-----------------------------------------------------------------------------
void CMaterial::Draw(CDC *pDC, RECT& rect, int iFontHeight, int iIconHeight, DrawTexData_t &DrawTexData)//, BrowserData_t *pBrowserData)
{
	g_pMaterialImageCache->EnCache(this);
	if (!this->HasData())
	{
		return;
	}
	
	if (m_nWidth <= 0)
	{
NoData:
		// draw "no data"
		CFont *pOldFont = (CFont*) pDC->SelectStockObject(ANSI_VAR_FONT);
		COLORREF cr = pDC->SetTextColor(RGB(0xff, 0xff, 0xff));
		COLORREF cr2 = pDC->SetBkColor(RGB(0, 0, 0));

		// draw black rect first
		pDC->FillRect(&rect, CBrush::FromHandle(HBRUSH(GetStockObject(BLACK_BRUSH))));

		// then text
		pDC->TextOut(rect.left+2, rect.top+2, "No Image", 8);
		pDC->SelectObject(pOldFont);
		pDC->SetTextColor(cr);
		pDC->SetBkColor(cr2);
		return;
	}

	// no data -
	if (!m_pData)
	{
		// try to load -
		if (!Load())
		{
			// can't load -
			goto NoData;
		}
	}

	// Draw the material image
	RECT srcRect, dstRect;
	srcRect.left = 0;
	srcRect.top = 0;
	srcRect.right = m_nWidth;
	srcRect.bottom = m_nHeight;
	dstRect = rect;

	if (DrawTexData.nFlags & drawCaption)
	{
		dstRect.bottom -= iFontHeight +  4;
	}
	if (DrawTexData.nFlags & drawIcons)
	{
		dstRect.bottom -= iIconHeight;
	}

	if (!(DrawTexData.nFlags & drawResizeAlways))
	{
		if (m_nWidth < dstRect.right - dstRect.left )
		{
			dstRect.right = dstRect.left + m_nWidth;
		}

		if (m_nHeight < dstRect.bottom - dstRect.top )
		{
			dstRect.bottom = dstRect.top + m_nHeight;
		}
	}
	DrawBitmap( pDC, srcRect, dstRect );

	// Draw the icons
	if (DrawTexData.nFlags & drawIcons)
	{
		dstRect = rect;
		if (DrawTexData.nFlags & drawCaption)
		{
			dstRect.bottom -= iFontHeight + 5; 
		}
		dstRect.top = dstRect.bottom - iIconHeight; 
		DrawBrowserIcons(pDC, dstRect, (DrawTexData.nFlags & drawErrors) != 0 );
	}

	// ** caption **
	if (DrawTexData.nFlags & drawCaption)
	{
		// draw background for name
		CBrush brCaption(RGB(0, 0, 255));
		CRect rcCaption(rect);
		
		rcCaption.top = rcCaption.bottom - (iFontHeight + 5);
		pDC->FillRect(rcCaption, &brCaption);

		// draw name
		char szShortName[MAX_PATH];
		int iLen = GetShortName(szShortName);
		pDC->TextOut(rect.left, rect.bottom - (iFontHeight + 4), szShortName, iLen);

		// draw usage count
		if (DrawTexData.nFlags & drawUsageCount)
		{
			CString str;
			str.Format("%d", DrawTexData.nUsageCount);
			CSize size = pDC->GetTextExtent(str);
			pDC->TextOut(rect.right - size.cx, rect.bottom - (iFontHeight + 4), str);
		}
	}
}
void PixelInfoListCtrl::DoUpdateList()
{
  Reset();

  LayerCollection* lc_mri = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );
  LayerCollection* lc_surf = MainWindow::GetMainWindowPointer()->GetLayerCollection( "Surface" );
  if ( !lc_mri || !lc_surf )
  {
    // collection does not exist. program must be in exiting process.
    return;
  }
  if ( lc_mri->IsEmpty() && lc_surf->IsEmpty() )
  {
    SetItemCount( 0 );
    return;
  }
  else
    AddItem( _("RAS"), _(""), 1, false );
  
  if ( !lc_mri->IsEmpty() )
  {
    LayerMRI* mri = ( LayerMRI* )lc_mri->GetLayer( 0 );
    double ras[3];
    mri->RemapPositionToRealRAS( m_dRASPosition, ras );
    m_listValue[0].Printf( _("%.2f, %.2f, %.2f"), ras[0], ras[1], ras[2] );

    int nIndex[3];
    std::vector<Layer*> layers = lc_mri->GetLayers();
    for ( size_t i = 0; i < layers.size(); i++ )
    {      
      if ( layers[i]->GetProperties()->GetShowInfo() )
      {
        ((LayerMRI*)layers[i])->RASToOriginalIndex( ras, nIndex );
  //      double dvalue = ( (LayerMRI*)layers[i] )->GetVoxelValueByOriginalIndex( nIndex[0], nIndex[1], nIndex[2] );
        double dvalue = ( (LayerMRI*)layers[i] )->GetVoxelValue( m_dRASPosition );  
        wxString coordStrg;
        if ( m_bShowVoxelCoordinates )
          coordStrg.Printf( _("[%d, %d, %d] "), nIndex[0], nIndex[1], nIndex[2] );
        
        wxString labelStrg;
        if (layers[i]->IsTypeOf("PLabel"))
        {
          labelStrg = wxString::FromAscii( ( (LayerPLabel*)layers[i] )->GetLabelName( m_dRASPosition ).c_str() );
        }
        else
        {
          labelStrg = wxString::FromAscii( ( (LayerMRI*)layers[i] )->GetLabelName( dvalue ).c_str() );
          if ( m_bShowShortName )
            labelStrg = GetShortName( labelStrg );
        }
        
        AddItem( wxString::FromAscii( layers[i]->GetName() ),
                AppendSpaceString( ( wxString() << dvalue ) ) + coordStrg + _("  ") + labelStrg,
                (long)layers[i],
                false );
      }
    }
  }
  if ( !lc_surf->IsEmpty() )
  {
    if ( lc_mri->IsEmpty() )
    {
      double ras[3] = { m_dRASPosition[0], m_dRASPosition[1], m_dRASPosition[2] };
      // mri->RemapPositionToRealRAS( m_dRASPosition, ras );
      m_listValue[0].Printf( _("%.2f, %.2f, %.2f"), ras[0], ras[1], ras[2] );
    }

    std::vector<Layer*> layers = lc_surf->GetLayers();
    for ( size_t i = 0; i < layers.size(); i++ )
    {
      if ( layers[i]->GetProperties()->GetShowInfo() )
      {
        LayerSurface* surf = ( LayerSurface* )layers[i];
        AddSurfaceItem( surf, m_dRASPosition, false );
      }
    }
  }

  SetItemCount( m_listName.Count() );
}
Exemple #27
0
std::string SkirmishAIKey::ToString() const {
	return GetShortName() + " " + GetVersion();
}
Exemple #28
0
wxString PHPEntityClass::GetDisplayName() const { return GetShortName(); }