mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Automatic rc file creation (with app icon and manifest), CtrlLib: Nicer Win32 dialog icons
This commit is contained in:
parent
c5bea8d729
commit
bb35660f7a
6 changed files with 84 additions and 2 deletions
|
|
@ -62,6 +62,7 @@ file
|
|||
TopWin32.cpp,
|
||||
DHCtrl.cpp,
|
||||
Win32Msg.i,
|
||||
manifest.xml,
|
||||
X11 readonly separator,
|
||||
X11Gui.h,
|
||||
X11GuiA.h,
|
||||
|
|
|
|||
|
|
@ -515,8 +515,18 @@ Image SystemDraw::Win32IconCursor(LPCSTR id, int iconsize, bool cursor)
|
|||
if(iconsize)
|
||||
icon = (HICON)LoadImage(GetModuleHandle(NULL), id,
|
||||
IMAGE_ICON, iconsize, iconsize, LR_DEFAULTCOLOR);
|
||||
else
|
||||
icon = LoadIcon(0, id);
|
||||
else {
|
||||
static HRESULT (WINAPI *LoadIconWithScaleDown)(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico);
|
||||
ONCELOCK {
|
||||
DllFn(LoadIconWithScaleDown, "Comctl32.dll", "LoadIconWithScaleDown");
|
||||
}
|
||||
|
||||
icon = NULL;
|
||||
if(LoadIconWithScaleDown)
|
||||
LoadIconWithScaleDown(0, (PCWSTR) id, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), &icon);
|
||||
else
|
||||
icon = LoadIcon(0, id);
|
||||
}
|
||||
Image img = sWin32Icon(icon, cursor);
|
||||
if(cursor)
|
||||
img.SetAuxData(reinterpret_cast<uint64>(id));
|
||||
|
|
|
|||
15
uppsrc/CtrlCore/manifest.xml
Normal file
15
uppsrc/CtrlCore/manifest.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
|
|
@ -35,6 +35,7 @@ struct CppBuilder : Builder {
|
|||
bool Cp(const String& cmd, const String& package, bool& error);
|
||||
bool Cd(const String& cmd);
|
||||
Vector<String> CustomStep(const String& path, const String& package, bool& error);
|
||||
void DoRc(Vector<String>& sfile, Vector<String>& soptions, const Package& pkg, const String& package);
|
||||
|
||||
String Includes(const char *sep, const String& package, const Package& pkg);
|
||||
void SaveBuildInfo(const String& package);
|
||||
|
|
|
|||
|
|
@ -479,6 +479,59 @@ String CppBuilder::Includes(const char *sep, const String& package, const Packag
|
|||
return cc;
|
||||
}
|
||||
|
||||
bool IsWin32Manifest(const String& s)
|
||||
{
|
||||
return s == "manifest.xml";
|
||||
}
|
||||
|
||||
void CppBuilder::DoRc(Vector<String>& sfile, Vector<String>& soptions, const Package& pkg, const String& package)
|
||||
{
|
||||
if(!HasFlag("MAIN") || !HasFlag("WIN32") || !HasFlag("GUI"))
|
||||
return;
|
||||
for(int i = 0; i < sfile.GetCount(); i++)
|
||||
if(sfile[i].EndsWith(".rc"))
|
||||
return;
|
||||
String icon_path;
|
||||
String manifest_path;
|
||||
|
||||
auto DoManifest = [&](const Package& pkg, const String& package) {
|
||||
for(int i = 0; i < pkg.GetCount(); i++)
|
||||
if(IsWin32Manifest(pkg[i]))
|
||||
manifest_path = SourcePath(package, pkg[i]);
|
||||
};
|
||||
|
||||
for(int i = 0; i < wspc.GetCount(); i++)
|
||||
DoManifest(wspc.GetPackage(i), wspc[i]);
|
||||
DoManifest(pkg, package); // main package manifest has priority
|
||||
String d = GetFileFolder(PackagePath(package));
|
||||
for(FindFile ff(d + "/*.*"); ff; ff.Next()) {
|
||||
String p = ff.GetPath();
|
||||
String n = GetFileName(p);
|
||||
if(n == "icon.ico")
|
||||
icon_path = p;
|
||||
}
|
||||
|
||||
String rc_file = CatAnyPath(outdir, "main.rc");
|
||||
|
||||
String rc;
|
||||
|
||||
if(manifest_path.GetCount()) {
|
||||
SaveChangedFile(CatAnyPath(outdir, "manifest.xml"), LoadFile(manifest_path));
|
||||
rc << "1 24 \"manifest.xml\"\r\n";
|
||||
}
|
||||
if(icon_path.GetCount()) {
|
||||
SaveChangedFile(CatAnyPath(outdir, "icon.ico"), LoadFile(icon_path));
|
||||
rc << "2 ICON DISCARDABLE \"icon.ico\"\r\n";
|
||||
}
|
||||
|
||||
if(IsNull(rc))
|
||||
return;
|
||||
|
||||
SaveChangedFile(rc_file, rc);
|
||||
sfile.Add(rc_file);
|
||||
soptions.Add();
|
||||
}
|
||||
|
||||
Vector<String> RepoInfo(const String& package)
|
||||
{
|
||||
Vector<String> info;
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
|
|||
if(pkg.nowarnings)
|
||||
cc << " -w";
|
||||
|
||||
DoRc(sfile, soptions, pkg, package);
|
||||
|
||||
int recompile = 0;
|
||||
Blitz b;
|
||||
if(blitz) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue