WXMainToolbar(wxFrame *parent)
    {
        m_tb = wxXmlResource::Get()->LoadToolBar(parent, "toolbar");
        m_idUpdate = XRCID("toolbar_update");

#ifdef __WXGTK3__
        gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(Toolbar())), GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
        SetIcon(0 , "document-open-symbolic");
        SetIcon(1 , "document-save-symbolic");
        SetIcon(3 , "poedit-validate-symbolic");
        SetIcon(4 , "poedit-update-symbolic");
        SetIcon(6 , "sidebar-symbolic");
#endif

#ifdef __WXMSW__
        // De-uglify the toolbar a bit on Windows 10:
        if (IsWindows10OrGreater())
        {
            if (wxUxThemeIsActive())
            {
                wxUxThemeHandle hTheme(m_tb, L"ExplorerMenu::Toolbar");
                m_tb->SetBackgroundColour(wxRGBToColour(::GetThemeSysColor(hTheme, COLOR_WINDOW)));
            }

            unsigned padding = PX(4);
            ::SendMessage((HWND) m_tb->GetHWND(), TB_SETPADDING, 0, MAKELPARAM(padding, padding));
        }
        m_tb->SetDoubleBuffered(true);
#endif
    }
Exemple #2
0
ManagerFrame::ManagerFrame() :
    wxFrame(NULL, -1, _("Poedit - Catalogs manager"),
            wxDefaultPosition, wxDefaultSize,
            wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE,
            "manager")
{
#if defined(__WXGTK__)
    wxIconBundle appicons;
    appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(16,16)));
    appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(32,32)));
    appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(48,48)));
    SetIcons(appicons);
#elif defined(__WXMSW__)
    SetIcons(wxIconBundle(wxStandardPaths::Get().GetResourcesDir() + "\\Resources\\Poedit.ico"));
#endif

    ms_instance = this;

    auto tb = wxXmlResource::Get()->LoadToolBar(this, "manager_toolbar");
    (void)tb;
#ifdef __WXMSW__
    // De-uglify the toolbar a bit on Windows 10:
    if (IsWindows10OrGreater())
    {
        const wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
        if (theme)
        {
            wxUxThemeHandle hTheme(tb, L"ExplorerMenu::Toolbar");
            tb->SetBackgroundColour(wxRGBToColour(theme->GetThemeSysColor(hTheme, COLOR_WINDOW)));
        }
    }
#endif

    wxPanel *panel = wxXmlResource::Get()->LoadPanel(this, "manager_panel");

    m_listPrj = XRCCTRL(*panel, "prj_list", wxListBox);
    m_listCat = XRCCTRL(*panel, "prj_files", wxListCtrl);
    m_splitter = XRCCTRL(*panel, "manager_splitter", wxSplitterWindow);

    wxImageList *list = new wxImageList(PX(16), PX(16));
    list->Add(wxArtProvider::GetBitmap("poedit-status-cat-no"));
    list->Add(wxArtProvider::GetBitmap("poedit-status-cat-mid"));
    list->Add(wxArtProvider::GetBitmap("poedit-status-cat-ok"));
    m_listCat->AssignImageList(list, wxIMAGE_LIST_SMALL);

    m_curPrj = -1;

    int last = (int)wxConfig::Get()->Read("manager_last_selected", (long)0);

    // FIXME: do this in background (here and elsewhere)
    UpdateListPrj(last);
    if (m_listPrj->GetCount() > 0)
        UpdateListCat(last);

    RestoreWindowState(this, wxSize(PX(400), PX(300)));

    m_splitter->SetSashPosition((int)wxConfig::Get()->Read("manager_splitter", PX(200)));
}
Exemple #3
0
	NTSTATUS ProcessCore::Open(DWORD pid, DWORD access) {
		// Prevent handle leak
		Close();
		// Handle current process differently
		_hProcess = (pid == GetCurrentProcessId()) ? GetCurrentProcess() : OpenProcess(access, false, pid);
		// Some routines in win10 does not support pseudo handle
		if(IsWindows10OrGreater() && pid == GetCurrentProcessId())
			_hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
		if(_hProcess != NULL) {
			_pid = pid;
			return Init();
		}
		return LastNtStatus();
	}
Exemple #4
0
/// <summary>
/// Reload driver
/// </summary>
/// <param name="path">Path to the driver file</param>
/// <returns>Status code</returns>
NTSTATUS DriverControl::Reload( std::wstring path /*= L"" */ )
{
    NTSTATUS status = STATUS_SUCCESS;

    Unload();

    // Use default path
    if (path.empty())
    {
        const wchar_t* filename = nullptr;

        if (IsWindows10OrGreater())
            filename = L"BlackBoneDrv10.sys";
        else if (IsWindows8Point1OrGreater())
            filename = L"BlackBoneDrv81.sys";
        else if (IsWindows8OrGreater())
            filename = L"BlackBoneDrv8.sys";
        else if (IsWindows7OrGreater())
            filename = L"BlackBoneDrv7.sys";
        else
            filename = L"BlackBoneDrv.sys";

        path = Utils::GetExeDirectory() + L"\\" + filename;
    }

    status = _loadStatus = LoadDriver( DRIVER_SVC_NAME, path );
    if (!NT_SUCCESS( status ))
    {
        BLACBONE_TRACE( L"Failed to load driver %ls. Status 0x%X", path.c_str(), status );
        return LastNtStatus( status );
    }

    _hDriver = CreateFileW(
                   BLACKBONE_DEVICE_FILE,
                   GENERIC_READ | GENERIC_WRITE,
                   FILE_SHARE_READ | FILE_SHARE_WRITE,
                   NULL, OPEN_EXISTING, 0, NULL
               );

    if (_hDriver == INVALID_HANDLE_VALUE)
    {
        status = LastNtStatus();
        BLACBONE_TRACE( L"Failed to open driver handle. Status 0x%X", status );
        return status;
    }

    return status;
}
Exemple #5
0
/// <summary>
/// Reload driver
/// </summary>
/// <param name="path">Path to the driver file</param>
/// <returns>Status code</returns>
NTSTATUS DriverControl::Reload( std::wstring path /*= L"" */ )
{
    Unload();

    // Use default path
    if (path.empty())
    {
        const wchar_t* filename = nullptr;

        if (IsWindows10OrGreater())
            filename = BLACKBONE_FILE_NAME_10;
        else if (IsWindows8Point1OrGreater())
            filename = BLACKBONE_FILE_NAME_81;
        else if (IsWindows8OrGreater())
            filename = BLACKBONE_FILE_NAME_8;
        else if (IsWindows7OrGreater())
            filename = BLACKBONE_FILE_NAME_7;
        else
            filename = BLACKBONE_FILE_NAME;

        path = Utils::GetExeDirectory() + L"\\" + filename;
    }

    _loadStatus = LoadDriver( DRIVER_SVC_NAME, path );
    if (!NT_SUCCESS( _loadStatus ))
    {
        BLACKBONE_TRACE( L"Failed to load driver %ls. Status 0x%X", path.c_str(), _loadStatus );
        return _loadStatus;
    }

    _hDriver = CreateFileW( 
        BLACKBONE_DEVICE_FILE, 
        GENERIC_READ | GENERIC_WRITE, 
        FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, 0, NULL
        );

    if (!_hDriver)
    {
        _loadStatus = LastNtStatus();
        BLACKBONE_TRACE( L"Failed to open driver handle. Status 0x%X", _loadStatus );
        return _loadStatus;
    }

    return _loadStatus;
}
//////////////////////////////////////////////////////////
//
// RequiresAltTabFix
//
// Return true if there might be an alt-tab black screen problem when using gta_sa.exe
//
//////////////////////////////////////////////////////////
bool RequiresAltTabFix( void )
{
    // Exception for optimus because of better hi-perf detection when using gta_sa.exe
    if ( GetApplicationSettingInt( "nvhacks", "optimus" ) )
        return false;

    // Check for problem combo of: Windows 10 + NVidia card + full screen
    if ( IsWindows10OrGreater() && GetApplicationSettingInt( "nvhacks", "nvidia" ) )
    {
        // Slighty hacky way of checking in-game settings
        SString strCoreConfig;
        FileLoad( CalcMTASAPath( PathJoin( "mta", "config", "coreconfig.xml" ) ), strCoreConfig );
        int iWindowed        = atoi( strCoreConfig.SplitRight( "<display_windowed>" ) );
        int iFullscreenStyle = atoi( strCoreConfig.SplitRight( "<display_fullscreen_style>" ) );
        if ( iWindowed == 0 && iFullscreenStyle == 0 )   // 0=FULLSCREEN_STANDARD
            return true;        
    }
    return false;
}
Exemple #7
0
void Host::initOS() {
#ifdef NUCLEUS_TARGET_ANDROID
    os.name = "Android";
#endif
#ifdef NUCLEUS_TARGET_IOS
    os.name = "iOS";
#endif
#ifdef NUCLEUS_TARGET_LINUX
    os.name = "Linux";
#endif
#ifdef NUCLEUS_TARGET_OSX
    os.name = "OSX";
#endif
#ifdef NUCLEUS_TARGET_UWP
    os.name = "Windows";
#endif
#ifdef NUCLEUS_TARGET_WINDOWS
    if (IsWindows10OrGreater()) {
        os.name = "Windows 10";
    } else if (IsWindows8Point1OrGreater()) {
        os.name = "Windows 8.1";
    } else if (IsWindows8OrGreater()) {
        os.name = "Windows 8";
    } else if (IsWindows7OrGreater()) {
        os.name = "Windows 7";
    } else if (IsWindowsVistaSP2OrGreater()) {
        os.name = "Windows Vista SP2";
    } else if (IsWindowsVistaSP1OrGreater()) {
        os.name = "Windows Vista SP1";
    } else if (IsWindowsVistaOrGreater()) {
        os.name = "Windows Vista";
    } else if (IsWindowsXPSP3OrGreater()) {
        os.name = "Windows XP SP3";
    } else if (IsWindowsXPSP2OrGreater()) {
        os.name = "Windows XP SP2";
    } else if (IsWindowsXPSP1OrGreater()) {
        os.name = "Windows XP SP1";
    } else if (IsWindowsXPOrGreater()) {
        os.name = "Windows XP";
    }
#endif
}
BOOL CSetMainPage::OnInitDialog()
{
    ISettingsPropPage::OnInitDialog();

    EnableToolTips();

    m_sTempExtensions = m_regExtensions;
    m_dwLanguage = m_regLanguage;
    m_bUseAero = m_regUseAero;
    HIGHCONTRAST hc = { sizeof(HIGHCONTRAST) };
    SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST), &hc, FALSE);
    BOOL bEnabled = FALSE;
    DialogEnableWindow(IDC_AERODWM, ((hc.dwFlags & HCF_HIGHCONTRASTON) == 0) && SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && bEnabled);
    if (IsWindows10OrGreater())
        GetDlgItem(IDC_AERODWM)->ShowWindow(SW_HIDE);
    CString temp;
    temp = m_regLastCommitTime;
    m_bLastCommitTime = (temp.CompareNoCase(L"yes")==0);

    m_tooltips.AddTool(IDC_TEMPEXTENSIONSLABEL, IDS_SETTINGS_TEMPEXTENSIONS_TT);
    m_tooltips.AddTool(IDC_TEMPEXTENSIONS, IDS_SETTINGS_TEMPEXTENSIONS_TT);
    m_tooltips.AddTool(IDC_COMMITFILETIMES, IDS_SETTINGS_COMMITFILETIMES_TT);
    m_tooltips.AddTool(IDC_CREATELIB, IDS_SETTINGS_CREATELIB_TT);

    DialogEnableWindow(IDC_CREATELIB, IsWindows7OrGreater());

    // set up the language selecting combobox
    TCHAR buf[MAX_PATH] = { 0 };
    GetLocaleInfo(1033, LOCALE_SNATIVELANGNAME, buf, _countof(buf));
    m_LanguageCombo.AddString(buf);
    m_LanguageCombo.SetItemData(0, 1033);
    CString path = CPathUtils::GetAppParentDirectory();
    path = path + L"Languages\\";
    CSimpleFileFind finder(path, L"*.dll");
    int langcount = 1;
    while (finder.FindNextFileNoDirectories())
    {
        CString file = finder.GetFilePath();
        CString filename = finder.GetFileName();
        if (filename.Left(12).CompareNoCase(L"TortoiseProc")==0)
        {
            CString sVer = _T(STRPRODUCTVER);
            sVer = sVer.Left(sVer.ReverseFind('.'));
            CString sFileVer = CPathUtils::GetVersionFromFile(file);
            sFileVer = sFileVer.Left(sFileVer.ReverseFind('.'));
            if (sFileVer.Compare(sVer)!=0)
                continue;
            CString sLoc = filename.Mid(12);
            sLoc = sLoc.Left(sLoc.GetLength()-4);   // cut off ".dll"
            if ((sLoc.Left(2) == L"32")&&(sLoc.GetLength() > 5))
                continue;
            DWORD loc = _tstoi(filename.Mid(12));
            GetLocaleInfo(loc, LOCALE_SNATIVELANGNAME, buf, _countof(buf));
            CString sLang = buf;
            GetLocaleInfo(loc, LOCALE_SNATIVECTRYNAME, buf, _countof(buf));
            if (buf[0])
            {
                sLang += L" (";
                sLang += buf;
                sLang += L")";
            }
            m_LanguageCombo.AddString(sLang);
            m_LanguageCombo.SetItemData(langcount++, loc);
        }
    }

    for (int i=0; i<m_LanguageCombo.GetCount(); i++)
    {
        if (m_LanguageCombo.GetItemData(i) == m_dwLanguage)
            m_LanguageCombo.SetCurSel(i);
    }

    UpdateData(FALSE);
    return TRUE;
}
Exemple #9
0
wxBitmap PoeditArtProvider::CreateBitmap(const wxArtID& id_,
                                         const wxArtClient& client,
                                         const wxSize& size)
{
    wxLogTrace("poedit.icons", "getting icon '%s'", id_.c_str());

    wxArtID id(id_);
    #define CHECK_FOR_VARIANT(name)                         \
        const bool name##Variant = id.Contains("@" #name);  \
        if (name##Variant)                                  \
            id.Replace("@" #name, "")
    CHECK_FOR_VARIANT(disabled);
    CHECK_FOR_VARIANT(opaque);
    CHECK_FOR_VARIANT(inverted);

    // Silence warning about unused parameter in some of the builds
    (void)client;
    (void)size;

    // Note: On Unix, this code is only called as last resort, if standard
    //       theme provider (that uses current icon theme and files from
    //       /usr/share/icons/<theme>) didn't find any matching icon.

#ifdef __WXGTK20__
    // try legacy GNOME icons from standard theme:
    wxString gnomeId = GetGnomeStockId(id);
    if ( !gnomeId.empty() )
    {
        wxLogTrace("poedit.icons", "-> legacy '%s'", gnomeId.c_str());
        wxBitmap gbmp(wxArtProvider::GetBitmap(gnomeId, client, size));
        if ( gbmp.Ok() )
            return gbmp;
    }
#endif // __WXGTK20__

    auto iconsdir = GetIconsDir();
    if ( !wxDirExists(iconsdir) )
    {
        wxLogTrace("poedit.icons",
                   "icons dir %s not found", iconsdir.c_str());
        return wxNullBitmap;
    }

    wxString icon;
    icon.Printf("%s/%s", iconsdir, id);
    wxLogTrace("poedit.icons", "loading from %s", icon);
    wxImage img;
    if (ColorScheme::GetAppMode() == ColorScheme::Dark)
        img = LoadScaledBitmap(icon + "Dark");
    if (!img.IsOk())
        img = LoadScaledBitmap(icon);

    if (!img.IsOk())
    {
        wxLogTrace("poedit.icons", "failed to load icon '%s'", id);
        return wxNullBitmap;
    }

    if (id.EndsWith("Template"))
        ProcessTemplateImage(img, opaqueVariant, invertedVariant);

    if (disabledVariant)
        img = img.ConvertToDisabled();

    if (wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft && ShouldBeMirorredInRTL(id, client))
    {
        img = img.Mirror();
    }

#ifdef __WXMSW__
    if (client == wxART_TOOLBAR && IsWindows10OrGreater())
    {
        const int padding = PX(1);
        auto sz = img.GetSize();
        sz.IncBy(padding * 2);
        img.Resize(sz, wxPoint(padding, padding));
    }
#endif // __WXMSW__

    return wxBitmap(img);
}