Merge branch 'master' into x86_64
This commit is contained in:
@@ -12,9 +12,9 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSL ] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
HAIKU_OPENSSL_PACKAGE = openssl-1.0.0e-x86-gcc4-2011-09-08.zip ;
|
HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
HAIKU_OPENSSL_PACKAGE = openssl-1.0.0e-x86-gcc2-2011-09-09.zip ;
|
HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86-gcc2-2012-06-19.zip ;
|
||||||
}
|
}
|
||||||
|
|
||||||
local baseURL = http://haiku-files.org/files/optional-packages ;
|
local baseURL = http://haiku-files.org/files/optional-packages ;
|
||||||
@@ -337,11 +337,11 @@ if $(TARGET_ARCH) = x86 {
|
|||||||
local freetypeBaseURL = http://haiku-files.org/files/optional-packages/lib ;
|
local freetypeBaseURL = http://haiku-files.org/files/optional-packages/lib ;
|
||||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||||
if $(TARGET_ARCH) = ppc {
|
if $(TARGET_ARCH) = ppc {
|
||||||
HAIKU_FREETYPE_FILE = freetype-2.4.6-ppc-gcc4-2012-03-17.zip ;
|
HAIKU_FREETYPE_FILE = freetype-2.4.9-ppc-gcc4-2012-06-26.zip ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
HAIKU_FREETYPE_FILE = freetype-2.4.6-x86-gcc4-2012-03-15.zip ;
|
HAIKU_FREETYPE_FILE = freetype-2.4.9-x86-gcc4-2012-06-15.zip ;
|
||||||
} else {
|
} else {
|
||||||
HAIKU_FREETYPE_FILE = freetype-2.4.6-x86-gcc2-2012-03-15.zip ;
|
HAIKU_FREETYPE_FILE = freetype-2.4.9-x86-gcc2-2012-06-19.zip ;
|
||||||
}
|
}
|
||||||
|
|
||||||
local freetypeZipFile = [ DownloadFile $(HAIKU_FREETYPE_FILE)
|
local freetypeZipFile = [ DownloadFile $(HAIKU_FREETYPE_FILE)
|
||||||
@@ -361,7 +361,7 @@ if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
|||||||
: extracted-freetype ] ;
|
: extracted-freetype ] ;
|
||||||
HAIKU_FREETYPE_CURRENT_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
|
HAIKU_FREETYPE_CURRENT_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
|
||||||
:
|
:
|
||||||
common/lib/libfreetype.so.6.7.1
|
common/lib/libfreetype.so.6.8.1
|
||||||
: $(freetypeZipFile)
|
: $(freetypeZipFile)
|
||||||
: extracted-freetype ] ;
|
: extracted-freetype ] ;
|
||||||
Depends $(HAIKU_FREETYPE_LIB) $(HAIKU_FREETYPE_CURRENT_LIB) : $(HAIKU_FREETYPE_HEADERS_DEPENDENCY) ;
|
Depends $(HAIKU_FREETYPE_LIB) $(HAIKU_FREETYPE_CURRENT_LIB) : $(HAIKU_FREETYPE_HEADERS_DEPENDENCY) ;
|
||||||
@@ -385,7 +385,7 @@ if [ IsOptionalHaikuImagePackageAdded TagLib ] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local baseURL = http://haiku-files.org/files/optional-packages ;
|
local baseURL = http://haiku-files.org/files/optional-packages ;
|
||||||
HAIKU_TAGLIB_PACKAGE = taglib-1.6.3-r1a2-x86-gcc2-2010-04-25.zip ;
|
HAIKU_TAGLIB_PACKAGE = taglib-1.6.3-r1a3-x86-gcc2-2011-05-20.zip ;
|
||||||
HAIKU_TAGLIB_URL = $(baseURL)/$(HAIKU_TAGLIB_PACKAGE) ;
|
HAIKU_TAGLIB_URL = $(baseURL)/$(HAIKU_TAGLIB_PACKAGE) ;
|
||||||
|
|
||||||
if $(HAIKU_BUILD_FEATURE_TAGLIB) {
|
if $(HAIKU_BUILD_FEATURE_TAGLIB) {
|
||||||
|
|||||||
@@ -227,78 +227,78 @@ if [ IsOptionalHaikuImagePackageAdded SDLLibs ] {
|
|||||||
Echo "No optional package SDLLibs available for $(TARGET_ARCH)" ;
|
Echo "No optional package SDLLibs available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
libsdl-1.2-hg-r1a3-x86-gcc4-2011-05-29.zip
|
libsdl-1.2.15-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/libsdl-1.2-hg-r1a3-x86-gcc4-2011-05-29.zip ;
|
: $(baseURL)/lib/libsdl-1.2.15-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
guilib-1.2.1-r1a3-x86-gcc4-2011-05-26.zip
|
guilib-1.2.1-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/guilib-1.2.1-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/guilib-1.2.1-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-gfx-2.0.22-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-gfx-2.0.23-x86-gcc4-2011-05-31.zip
|
||||||
: $(baseURL)/lib/sdl-gfx-2.0.22-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-gfx-2.0.23-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-image-1.2.10-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-image-1.2.12-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/sdl-image-1.2.10-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-image-1.2.12-x86-gcc4-2011-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-mixer-1.2.11-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-mixer-1.2.11-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/sdl-mixer-1.2.11-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-mixer-1.2.11-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-net-1.2.7-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-net-1.2.8-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/sdl-net-1.2.7-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-net-1.2.8-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-sound-1.0.3-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-sound-1.0.3-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/sdl-sound-1.0.3-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-sound-1.0.3-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-rtf-0.1.0-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-rtf-0.1.0-r1a3-x86-gcc4-2011-05-26.zip
|
||||||
: $(baseURL)/lib/sdl-rtf-0.1.0-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-rtf-0.1.0-r1a3-x86-gcc4-2011-05-26.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-ttf-2.0.10-r1a3-x86-gcc4-2011-05-26.zip
|
sdl-ttf-2.0.11-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/sdl-ttf-2.0.10-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sdl-ttf-2.0.11-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sge-030809-r1a3-x86-gcc4-2011-05-26.zip
|
sge-030809-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/sge-030809-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/sge-030809-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
smjpeg-0.2.1-r1a3-x86-gcc4-2011-05-26.zip
|
smjpeg-0.2.1-x86-gcc4-2012-05-31.zip
|
||||||
: $(baseURL)/lib/smjpeg-0.2.1-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/smjpeg-0.2.1-x86-gcc4-2012-05-31.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
smpeg-0.4.5-r1a3-x86-gcc4-2011-05-26.zip
|
smpeg-0.4.5-x86-gcc4-2011-05-31.zip
|
||||||
: $(baseURL)/lib/smpeg-0.4.5-r1a3-x86-gcc4-2011-05-26.zip ;
|
: $(baseURL)/lib/smpeg-0.4.5-x86-gcc4-2012-05-31.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
libsdl-1.2-hg-r1a3-x86-gcc2-2011-05-29.zip
|
libsdl-1.2.15-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/libsdl-1.2-hg-r1a3-x86-gcc2-2011-05-29.zip ;
|
: $(baseURL)/lib/libsdl-1.2.15-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
guilib-1.2.1-r1a3-x86-gcc2-2011-05-19.zip
|
guilib-1.2.1-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/guilib-1.2.1-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/guilib-1.2.1-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-gfx-2.0.22-r1a3-x86-gcc2-2011-05-19.zip
|
sdl-gfx-2.0.23-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/sdl-gfx-2.0.22-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sdl-gfx-2.0.23-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-image-1.2.10-x86-r1a3-x86-gcc2-2011-05-19.zip
|
sdl-image-1.2.12-x86-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/sdl-image-1.2.10-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sdl-image-1.2.12-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-mixer-1.2.11-r1a3-x86-gcc2-2011-05-19.zip
|
sdl-mixer-1.2.11-x86-gcc2-2012-06-25.zip
|
||||||
: $(baseURL)/lib/sdl-mixer-1.2.11-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sdl-mixer-1.2.11-x86-gcc2-2012-06-25.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-net-1.2.7-r1a3-x86-gcc2-2011-05-19.zip
|
sdl-net-1.2.8-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/sdl-net-1.2.7-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sdl-net-1.2.8-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-sound-1.0.3-r1a3-x86-gcc2-2011-05-19.zip
|
sdl-sound-1.0.3-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/sdl-sound-1.0.3-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sdl-sound-1.0.3-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-rtf-0.1.0-r1a3-x86-gcc2-2011-05-20.zip
|
sdl-rtf-0.1.0-r1a3-x86-gcc2-2011-05-20.zip
|
||||||
: $(baseURL)/lib/sdl-rtf-0.1.0-r1a3-x86-gcc2-2011-05-20.zip ;
|
: $(baseURL)/lib/sdl-rtf-0.1.0-r1a3-x86-gcc2-2011-05-20.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sdl-ttf-2.0.10-r1a3-x86-gcc2-2011-05-19.zip
|
sdl-ttf-2.0.11-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/sdl-ttf-2.0.10-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sdl-ttf-2.0.11-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sge-030809-r1a3-x86-gcc2-2011-05-19.zip
|
sge-030809-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/sge-030809-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/sge-030809-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
smjpeg-0.2.1-r1a3-x86-gcc2-2011-05-19.zip
|
smjpeg-0.2.1-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/smjpeg-0.2.1-r1a3-x86-gcc2-2011-05-19.zip ;
|
: $(baseURL)/lib/smjpeg-0.2.1-x86-gcc2-2012-06-24.zip ;
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
smpeg-0.4.5-r1a3-x86-gcc2-2011-05-20.zip
|
smpeg-0.4.5-x86-gcc2-2012-06-24.zip
|
||||||
: $(baseURL)/lib/smpeg-0.4.5-r1a3-x86-gcc2-2011-05-20.zip ;
|
: $(baseURL)/lib/smpeg-0.4.5-x86-gcc2-2012-06-24.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ OptionalPackageDependencies Development : DevelopmentBase Perl ;
|
|||||||
OptionalPackageDependencies DevelopmentPowerPC : DevelopmentMin ;
|
OptionalPackageDependencies DevelopmentPowerPC : DevelopmentMin ;
|
||||||
OptionalPackageDependencies GetText : LibIconv ;
|
OptionalPackageDependencies GetText : LibIconv ;
|
||||||
OptionalPackageDependencies Git : Expat Curl OpenSSL LibIconv ;
|
OptionalPackageDependencies Git : Expat Curl OpenSSL LibIconv ;
|
||||||
|
OptionalPackageDependencies GitDoc : Man Git ;
|
||||||
OptionalPackageDependencies ICU-devel : DevelopmentBase ;
|
OptionalPackageDependencies ICU-devel : DevelopmentBase ;
|
||||||
OptionalPackageDependencies LibLayout : DevelopmentBase ;
|
OptionalPackageDependencies LibLayout : DevelopmentBase ;
|
||||||
OptionalPackageDependencies Man : Groff ;
|
OptionalPackageDependencies Man : Groff ;
|
||||||
|
|||||||
+91
-70
@@ -50,6 +50,7 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1
|
|||||||
# friss - RSS/ATOM/... feeds reader
|
# friss - RSS/ATOM/... feeds reader
|
||||||
# GetText - a framework to help produce multi-lingual messages.
|
# GetText - a framework to help produce multi-lingual messages.
|
||||||
# Git - the distributed version control system
|
# Git - the distributed version control system
|
||||||
|
# GitDoc - documentation for the distributed version control system
|
||||||
# GPerf - the perfect hash function generator.
|
# GPerf - the perfect hash function generator.
|
||||||
# Groff - text formatter used for man pages
|
# Groff - text formatter used for man pages
|
||||||
# ICU-devel - the headers and lib-links for ICU (for development)
|
# ICU-devel - the headers and lib-links for ICU (for development)
|
||||||
@@ -122,13 +123,13 @@ if [ IsOptionalHaikuImagePackageAdded APR ] {
|
|||||||
Echo "No optional package APR available for $(TARGET_ARCH)" ;
|
Echo "No optional package APR available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
apr-1.4.5-x86-gcc4-2011-08-03.zip
|
apr-1.4.6-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/apr-1.4.5-x86-gcc4-2011-08-03.zip
|
: $(baseURL)/apr-1.4.6-x86-gcc4-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
apr-1.4.5-x86-gcc2-2011-08-02.zip
|
apr-1.4.6-x86-gcc2-2012-06-19.zip
|
||||||
: $(baseURL)/apr-1.4.5-x86-gcc2-2011-08-02.zip
|
: $(baseURL)/apr-1.4.6-x86-gcc2-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,13 +141,13 @@ if [ IsOptionalHaikuImagePackageAdded APR-util ] {
|
|||||||
Echo "No optional package APR-util available for $(TARGET_ARCH)" ;
|
Echo "No optional package APR-util available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
apr-util-1.3.12-x86-gcc4-2011-08-03.zip
|
apr-util-1.4.1-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/apr-util-1.3.12-x86-gcc4-2011-08-03.zip
|
: $(baseURL)/apr-util-1.4.1-x86-gcc4-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
apr-util-1.3.12-x86-gcc2-2011-08-02.zip
|
apr-util-1.4.1-x86-gcc2-2012-06-19.zip
|
||||||
: $(baseURL)/apr-util-1.3.12-x86-gcc2-2011-08-02.zip
|
: $(baseURL)/apr-util-1.4.1-x86-gcc2-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,11 +174,11 @@ if [ IsOptionalHaikuImagePackageAdded Bazaar ] {
|
|||||||
if $(TARGET_ARCH) != x86 {
|
if $(TARGET_ARCH) != x86 {
|
||||||
Echo "No optional package Bazaar available for $(TARGET_ARCH)" ;
|
Echo "No optional package Bazaar available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage bzr-2.6b1-x86-gcc4-2012-03-30.zip
|
InstallOptionalHaikuImagePackage bzr-2.5.1-x86-gcc4-2012-06-22.zip
|
||||||
: $(baseURL)/bzr-2.6b1-x86-gcc4-2012-03-30.zip ;
|
: $(baseURL)/bzr-2.5.1-x86-gcc4-2012-06-22.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage bzr-2.6b1-x86-gcc2-2012-03-31.zip
|
InstallOptionalHaikuImagePackage bzr-2.5.1-x86-gcc2-2012-06-22.zip
|
||||||
: $(baseURL)/bzr-2.6b1-x86-gcc2-2012-03-31.zip ;
|
: $(baseURL)/bzr-2.5.1-x86-gcc2-2012-06-22.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,12 +409,12 @@ if [ IsOptionalHaikuImagePackageAdded CDRecord ] {
|
|||||||
Echo "No optional package CDRecord available for $(TARGET_ARCH)" ;
|
Echo "No optional package CDRecord available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
cdrtools-3.01a01-r1a3-x86-gcc4-2011-05-23.zip
|
cdrtools-3.01a06-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/cdrtools-3.01a01-r1a3-x86-gcc4-2011-05-23.zip ;
|
: $(baseURL)/cdrtools-3.01a06-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
cdrtools-3.01a01-r1a3-x86-gcc2-2011-05-17.zip
|
cdrtools-3.01a06-x86-gcc2-2012-06-20.zip
|
||||||
: $(baseURL)/cdrtools-3.01a01-r1a3-x86-gcc2-2011-05-17.zip ;
|
: $(baseURL)/cdrtools-3.01a06-x86-gcc2-2012-06-20.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,11 +533,11 @@ if [ IsOptionalHaikuImagePackageAdded Curl ] {
|
|||||||
if $(TARGET_ARCH) != x86 {
|
if $(TARGET_ARCH) != x86 {
|
||||||
Echo "No optional package Curl available for $(TARGET_ARCH)" ;
|
Echo "No optional package Curl available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage curl-7.21.7-x86-gcc4-2012-02-18.zip
|
InstallOptionalHaikuImagePackage curl-7.26.0-x86-gcc4-2012-06-20.zip
|
||||||
: $(baseURL)/curl-7.21.7-x86-gcc4-2012-02-18.zip ;
|
: $(baseURL)/curl-7.26.0-x86-gcc4-2012-06-20.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage curl-7.21.7-x86-gcc2-2012-02-18.zip
|
InstallOptionalHaikuImagePackage curl-7.26.0-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/curl-7.21.7-x86-gcc2-2012-02-18.zip ;
|
: $(baseURL)/curl-7.26.0-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,13 +549,13 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
cvs-1.12.13.1-r1a3-x86-gcc4-2011-05-24.zip
|
cvs-1.12.13.1-x86-gcc4-2012-06-22.zip
|
||||||
: $(baseURL)/cvs-1.12.13.1-r1a3-x86-gcc4-2011-05-24.zip
|
: $(baseURL)/cvs-1.12.13.1-x86-gcc4-2012-06-22.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
cvs-1.12.13.1-r1a3-x86-gcc2-2011-05-18.zip
|
cvs-1.12.13.1-x86-gcc2-2012-06-20.zip
|
||||||
: $(baseURL)/cvs-1.12.13.1-r1a3-x86-gcc2-2011-05-18.zip
|
: $(baseURL)/cvs-1.12.13.1-x86-gcc2-2012-06-20.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -912,8 +913,8 @@ if [ IsOptionalHaikuImagePackageAdded Expat ] {
|
|||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
expat-2.0.1-r1a3-x86-gcc2-2011-05-20.zip
|
expat-2.0.1-x86-gcc2-2012-06-20.zip
|
||||||
: $(baseURL)/expat-2.0.1-r1a3-x86-gcc2-2011-05-20.zip
|
: $(baseURL)/expat-2.0.1-x86-gcc2-2012-06-20.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -983,13 +984,33 @@ if [ IsOptionalHaikuImagePackageAdded Git ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
git-1.7.7.2-x86-gcc4-2011-11-04.zip
|
git-1.7.10.2-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/git-1.7.7.2-x86-gcc4-2011-11-04.zip
|
: $(baseURL)/git-1.7.10.2-x86-gcc4-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
git-1.7.7.2-x86-gcc2-2011-11-04.zip
|
git-1.7.10.2-x86-gcc2-2012-06-20.zip
|
||||||
: $(baseURL)/git-1.7.7.2-x86-gcc2-2011-11-04.zip
|
: $(baseURL)/git-1.7.10.2-x86-gcc2-2012-06-20.zip
|
||||||
|
: : true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# GitDoc
|
||||||
|
if [ IsOptionalHaikuImagePackageAdded GitDoc ] {
|
||||||
|
if $(TARGET_ARCH) != x86 {
|
||||||
|
Echo "No optional package GitDoc available for $(TARGET_ARCH)" ;
|
||||||
|
} else {
|
||||||
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
|
InstallOptionalHaikuImagePackage
|
||||||
|
gitdoc-1.7.10.2-x86-gcc4-2012-06-20.zip
|
||||||
|
: $(baseURL)/gitdoc-1.7.10.2-x86-gcc4-2012-06-20.zip
|
||||||
|
: : true ;
|
||||||
|
} else {
|
||||||
|
InstallOptionalHaikuImagePackage
|
||||||
|
gitdoc-1.7.10.2-x86-gcc2-2012-06-20.zip
|
||||||
|
: $(baseURL)/gitdoc-1.7.10.2-x86-gcc2-2012-06-20.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1185,12 +1206,12 @@ if [ IsOptionalHaikuImagePackageAdded LibXML2 ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
libxml2-2.7.8-r1a3-x86-gcc4-2011-05-24.zip
|
libxml2-2.8.0-x86-gcc4-2012-06-18.zip
|
||||||
: $(baseURL)/libxml2-2.7.8-r1a3-x86-gcc4-2011-05-24.zip ;
|
: $(baseURL)/libxml2-2.8.0-x86-gcc4-2012-06-18.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
libxml2-2.7.8-r1a3-x86-gcc2-2011-05-18.zip
|
libxml2-2.8.0-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/libxml2-2.7.8-r1a3-x86-gcc2-2011-05-18.zip ;
|
: $(baseURL)/libxml2-2.8.0-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1254,12 +1275,12 @@ if [ IsOptionalHaikuImagePackageAdded Man ] {
|
|||||||
Echo "No optional package Man available for $(TARGET_ARCH)" ;
|
Echo "No optional package Man available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
man-1.6f-r1a3-x86-gcc4-2011-05-24.zip
|
man-1.6g-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/man-1.6f-r1a3-x86-gcc4-2011-05-24.zip ;
|
: $(baseURL)/man-1.6g-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
man-1.6f-r1a3-x86-gcc2-2011-05-18.zip
|
man-1.6g-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/man-1.6f-r1a3-x86-gcc2-2011-05-18.zip ;
|
: $(baseURL)/man-1.6g-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1277,13 +1298,13 @@ if [ IsOptionalHaikuImagePackageAdded Mercurial ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
mercurial-1.8.3-r1a3-x86-gcc4-2011-05-24.zip
|
mercurial-2.2.2-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/mercurial-1.8.3-r1a3-x86-gcc4-2011-05-24.zip
|
: $(baseURL)/mercurial-2.2.2-x86-gcc4-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
mercurial-1.8.3-r1a3-x86-gcc2-2011-05-17.zip
|
mercurial-2.2.2-x86-gcc2-2012-06-20.zip
|
||||||
: $(baseURL)/mercurial-1.8.3-r1a3-x86-gcc2-2011-05-17.zip
|
: $(baseURL)/mercurial-2.2.2-x86-gcc2-2012-06-20.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1315,12 +1336,12 @@ if [ IsOptionalHaikuImagePackageAdded Neon ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
neon-0.29.6-r1a3-x86-gcc4-2011-05-24.zip
|
neon-0.29.6-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/neon-0.29.6-r1a3-x86-gcc4-2011-05-24.zip ;
|
: $(baseURL)/neon-0.29.6-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
neon-0.29.6-r1a3-x86-gcc2-2011-05-18.zip
|
neon-0.29.6-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/neon-0.29.6-r1a3-x86-gcc2-2011-05-18.zip ;
|
: $(baseURL)/neon-0.29.6-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1412,12 +1433,12 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSH ] {
|
|||||||
|
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
openssh-5.9p1-x86-gcc4-2011-11-30.zip
|
openssh-6.0p1-x86-gcc4-2012-06-20.zip
|
||||||
: $(baseURL)/openssh-5.9p1-x86-gcc4-2011-11-30.zip ;
|
: $(baseURL)/openssh-6.0p1-x86-gcc4-2012-06-20.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
openssh-5.9p1-x86-gcc2-2011-11-30.zip
|
openssh-6.0p1-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/openssh-5.9p1-x86-gcc2-2011-11-30.zip ;
|
: $(baseURL)/openssh-6.0p1-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddUserToHaikuImage sshd : 1001 : 100 : /var/empty : /bin/true
|
AddUserToHaikuImage sshd : 1001 : 100 : /var/empty : /bin/true
|
||||||
@@ -1449,12 +1470,12 @@ if [ IsOptionalHaikuImagePackageAdded P7zip ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
p7zip-9.13-r1a3-x86-gcc4-2011-05-24.zip
|
p7zip-9.20.1-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/p7zip-9.13-r1a3-x86-gcc4-2011-05-24.zip ;
|
: $(baseURL)/p7zip-9.20.1-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
p7zip-9.13-r1a3-x86-gcc2-2011-05-18.zip
|
p7zip-9.20.1-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/p7zip-9.13-r1a3-x86-gcc2-2011-05-18.zip ;
|
: $(baseURL)/p7zip-9.20.1-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
AddExpanderRuleToHaikuImage "application/x-7z-compressed" : .7z
|
AddExpanderRuleToHaikuImage "application/x-7z-compressed" : .7z
|
||||||
: "7za l \\0045s"
|
: "7za l \\0045s"
|
||||||
@@ -1627,12 +1648,12 @@ if [ IsOptionalHaikuImagePackageAdded SQLite ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sqlite-3.7.7.1-x86-gcc4-2012-03-30.zip
|
sqlite-3.7.13-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/sqlite-3.7.7.1-x86-gcc4-2012-03-30.zip ;
|
: $(baseURL)/sqlite-3.7.13-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
sqlite-3.7.7.1-x86-gcc2-2012-03-31.zip
|
sqlite-3.7.13-x86-gcc2-2012-06-20.zip
|
||||||
: $(baseURL)/sqlite-3.7.7.1-x86-gcc2-2012-03-31.zip ;
|
: $(baseURL)/sqlite-3.7.13-x86-gcc2-2012-06-20.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1645,13 +1666,13 @@ if [ IsOptionalHaikuImagePackageAdded Subversion ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
subversion-1.6.17-x86-gcc4-2011-08-03.zip
|
subversion-1.6.18-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/subversion-1.6.17-x86-gcc4-2011-08-03.zip
|
: $(baseURL)/subversion-1.6.18-x86-gcc4-2012-06-19.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
subversion-1.6.17-x86-gcc2-2011-08-02.zip
|
subversion-1.6.18-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/subversion-1.6.17-x86-gcc2-2011-08-02.zip
|
: $(baseURL)/subversion-1.6.18-x86-gcc2-2012-06-21.zip
|
||||||
: : true ;
|
: : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1681,12 +1702,12 @@ if [ IsOptionalHaikuImagePackageAdded Tar ] {
|
|||||||
} else {
|
} else {
|
||||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
tar-1.25-r1a3-x86-gcc4-2011-05-24.zip
|
tar-1.26-x86-gcc4-2012-06-19.zip
|
||||||
: $(baseURL)/tar-1.25-r1a3-x86-gcc4-2011-05-24.zip ;
|
: $(baseURL)/tar-1.26-x86-gcc4-2012-06-19.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
tar-1.25-r1a3-x86-gcc2-2011-05-20.zip
|
tar-1.26-x86-gcc2-2012-06-21.zip
|
||||||
: $(baseURL)/tar-1.25-r1a3-x86-gcc2-2011-05-20.zip ;
|
: $(baseURL)/tar-1.26-x86-gcc2-2012-06-21.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1973,11 +1994,11 @@ if [ IsOptionalHaikuImagePackageAdded Yasm ] {
|
|||||||
Echo "No optional package Yasm available for $(TARGET_ARCH)" ;
|
Echo "No optional package Yasm available for $(TARGET_ARCH)" ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
yasm-1.1.0-r1a3-x86-gcc4-2011-05-24.zip
|
yasm-1.2.0-x86-gcc4-2012-06-18.zip
|
||||||
: $(baseURL)/yasm-1.1.0-r1a3-x86-gcc4-2011-05-24.zip ;
|
: $(baseURL)/yasm-1.2.0-x86-gcc4-2012-06-18.zip ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
yasm-1.1.0-r1a3-x86-gcc2-2011-05-17.zip
|
yasm-1.2.0-x86-gcc2-2012-06-19.zip
|
||||||
: $(baseURL)/yasm-1.1.0-r1a3-x86-gcc2-2011-05-17.zip ;
|
: $(baseURL)/yasm-1.2.0-x86-gcc2-2012-06-19.zip ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,7 +9,7 @@
|
|||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
class BStringView : public BView{
|
class BStringView : public BView {
|
||||||
public:
|
public:
|
||||||
BStringView(BRect bounds, const char* name,
|
BStringView(BRect bounds, const char* name,
|
||||||
const char* text, uint32 resizeFlags
|
const char* text, uint32 resizeFlags
|
||||||
|
|||||||
@@ -584,6 +584,8 @@ protected:
|
|||||||
|
|
||||||
virtual void LayoutChanged();
|
virtual void LayoutChanged();
|
||||||
|
|
||||||
|
void ScrollWithMouseWheelDelta(BScrollBar*, float);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Layout(bool force, BLayoutContext* context);
|
void _Layout(bool force, BLayoutContext* context);
|
||||||
void _LayoutLeft(BLayout* deleted);
|
void _LayoutLeft(BLayout* deleted);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010 Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef STRING_FOR_RATE_H
|
||||||
|
#define STRING_FOR_RATE_H
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
|
const char* string_for_rate(double rate, char* string, size_t stringSize,
|
||||||
|
double base = 1000.0f);
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
using BPrivate::string_for_rate;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // COLOR_QUANTIZER_H
|
||||||
@@ -1450,6 +1450,7 @@ AVFormatReader::Stream::Seek(uint32 flags, int64* frame, bigtime_t* time)
|
|||||||
|
|
||||||
AVFormatReader::AVFormatReader()
|
AVFormatReader::AVFormatReader()
|
||||||
:
|
:
|
||||||
|
fCopyright(""),
|
||||||
fStreams(NULL),
|
fStreams(NULL),
|
||||||
fSourceLock("source I/O lock")
|
fSourceLock("source I/O lock")
|
||||||
{
|
{
|
||||||
@@ -1478,12 +1479,12 @@ AVFormatReader::~AVFormatReader()
|
|||||||
const char*
|
const char*
|
||||||
AVFormatReader::Copyright()
|
AVFormatReader::Copyright()
|
||||||
{
|
{
|
||||||
// TODO: Could not find the equivalent in libavformat >= version 53.
|
if (fCopyright.Length() <= 0) {
|
||||||
// Use metadata API instead!
|
BMessage message;
|
||||||
// if (fStreams != NULL && fStreams[0] != NULL)
|
if (GetMetaData(&message) == B_OK)
|
||||||
// return fStreams[0]->Context()->copyright;
|
message.FindString("copyright", &fCopyright);
|
||||||
// TODO: Return copyright of the file instead!
|
}
|
||||||
return "Copyright 2009, Stephan Aßmus";
|
return fCopyright.String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1638,9 +1639,9 @@ AVFormatReader::GetMetaData(BMessage* _data)
|
|||||||
|
|
||||||
// Add program info
|
// Add program info
|
||||||
for (unsigned i = 0; i < context->nb_programs; i++) {
|
for (unsigned i = 0; i < context->nb_programs; i++) {
|
||||||
BMessage progamData;
|
BMessage programData;
|
||||||
avdictionary_to_message(context->programs[i]->metadata, &progamData);
|
avdictionary_to_message(context->programs[i]->metadata, &programData);
|
||||||
_data->AddMessage("be:program", &progamData);
|
_data->AddMessage("be:program", &programData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
#include "ReaderPlugin.h"
|
#include "ReaderPlugin.h"
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
class Stream;
|
class Stream;
|
||||||
|
|
||||||
|
BString fCopyright;
|
||||||
Stream** fStreams;
|
Stream** fStreams;
|
||||||
BLocker fSourceLock;
|
BLocker fSourceLock;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <Path.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
#include <TimeSource.h>
|
#include <TimeSource.h>
|
||||||
#include <TranslationKit.h>
|
#include <TranslationKit.h>
|
||||||
|
|
||||||
|
#include <storage/FindDirectory.h>
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "CodyCam"
|
#define B_TRANSLATION_CONTEXT "CodyCam"
|
||||||
@@ -169,7 +171,11 @@ CodyCam::CodyCam()
|
|||||||
kUploadClients[index++] = B_TRANSLATE("SFTP");
|
kUploadClients[index++] = B_TRANSLATE("SFTP");
|
||||||
kUploadClients[index++] = B_TRANSLATE("Local");
|
kUploadClients[index++] = B_TRANSLATE("Local");
|
||||||
|
|
||||||
chdir("/boot/home");
|
BPath homeDir;
|
||||||
|
if (find_directory(B_USER_DIRECTORY, &homeDir) != B_OK)
|
||||||
|
homeDir.SetTo("/boot/home");
|
||||||
|
|
||||||
|
chdir(homeDir.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
|
#include <Path.h>
|
||||||
|
#include <storage/FindDirectory.h>
|
||||||
|
|
||||||
#include "support_settings.h"
|
#include "support_settings.h"
|
||||||
|
|
||||||
@@ -329,8 +331,14 @@ IconEditorApp::_LastFilePath(path_kind which)
|
|||||||
path = fLastOpenPath.String();
|
path = fLastOpenPath.String();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!path)
|
if (!path) {
|
||||||
path = "/boot/home";
|
|
||||||
|
BPath homePath;
|
||||||
|
if (find_directory(B_USER_DIRECTORY, &homePath) == B_OK)
|
||||||
|
path = homePath.Path();
|
||||||
|
else
|
||||||
|
path = "/boot/home";
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
|
|
||||||
|
#include <storage/FindDirectory.h>
|
||||||
|
|
||||||
#include "MediaFileInfoView.h"
|
#include "MediaFileInfoView.h"
|
||||||
#include "MediaFileListView.h"
|
#include "MediaFileListView.h"
|
||||||
#include "MessageConstants.h"
|
#include "MessageConstants.h"
|
||||||
@@ -122,8 +124,10 @@ MediaConverterWindow::MediaConverterWindow(BRect frame)
|
|||||||
fConverting(false),
|
fConverting(false),
|
||||||
fCancelling(false)
|
fCancelling(false)
|
||||||
{
|
{
|
||||||
const char* defaultDirectory = "/boot/home";
|
BPath outputDir;
|
||||||
fOutputDir.SetTo(defaultDirectory);
|
if (find_directory(B_USER_DIRECTORY, &outputDir) != B_OK)
|
||||||
|
outputDir.SetTo("/boot/home");
|
||||||
|
fOutputDir.SetTo(outputDir.Path());
|
||||||
|
|
||||||
fMenuBar = new BMenuBar("menubar");
|
fMenuBar = new BMenuBar("menubar");
|
||||||
_CreateMenu();
|
_CreateMenu();
|
||||||
@@ -165,7 +169,7 @@ MediaConverterWindow::MediaConverterWindow(BRect frame)
|
|||||||
fDestButton = new BButton(B_TRANSLATE("Output folder"),
|
fDestButton = new BButton(B_TRANSLATE("Output folder"),
|
||||||
new BMessage(OUTPUT_FOLDER_MESSAGE));
|
new BMessage(OUTPUT_FOLDER_MESSAGE));
|
||||||
BAlignment labelAlignment(be_control_look->DefaultLabelAlignment());
|
BAlignment labelAlignment(be_control_look->DefaultLabelAlignment());
|
||||||
fOutputFolder = new BStringView(NULL, defaultDirectory);
|
fOutputFolder = new BStringView(NULL, outputDir.Path());
|
||||||
fOutputFolder->SetExplicitAlignment(labelAlignment);
|
fOutputFolder->SetExplicitAlignment(labelAlignment);
|
||||||
|
|
||||||
// start/end duration
|
// start/end duration
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
#include <StringForRate.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
@@ -405,6 +406,12 @@ printf("InfoWin::Update(0x%08lx)\n", which);
|
|||||||
rateString.ReplaceFirst("%d", "??");
|
rateString.ReplaceFirst("%d", "??");
|
||||||
s << rateString;
|
s << rateString;
|
||||||
}
|
}
|
||||||
|
if (format.type == B_MEDIA_ENCODED_AUDIO) {
|
||||||
|
float br = format.u.encoded_audio.bit_rate;
|
||||||
|
char string[20] = "";
|
||||||
|
if (br > 0.0)
|
||||||
|
s << ", " << string_for_rate(br, string, sizeof(string));
|
||||||
|
}
|
||||||
s << "\n\n";
|
s << "\n\n";
|
||||||
fContentsView->Insert(s.String());
|
fContentsView->Insert(s.String());
|
||||||
}
|
}
|
||||||
@@ -430,6 +437,8 @@ printf("InfoWin::Update(0x%08lx)\n", which);
|
|||||||
d = d % (60 * 1000);
|
d = d % (60 * 1000);
|
||||||
s << v << ":";
|
s << v << ":";
|
||||||
v = d / 1000;
|
v = d / 1000;
|
||||||
|
if (v < 10)
|
||||||
|
s << '0';
|
||||||
s << v;
|
s << v;
|
||||||
if (hours)
|
if (hours)
|
||||||
s << " " << B_TRANSLATE_COMMENT("h", "Hours");
|
s << " " << B_TRANSLATE_COMMENT("h", "Hours");
|
||||||
|
|||||||
@@ -243,9 +243,12 @@ void
|
|||||||
NetworkStatusView::AttachedToWindow()
|
NetworkStatusView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
if (Parent())
|
if (Parent() != NULL) {
|
||||||
SetViewColor(Parent()->ViewColor());
|
if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0)
|
||||||
else
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
|
else
|
||||||
|
SetViewColor(Parent()->ViewColor());
|
||||||
|
} else
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
SetLowColor(ViewColor());
|
SetLowColor(ViewColor());
|
||||||
|
|||||||
+181
-129
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2006, Haiku.
|
* Copyright 2003-2006, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2004-2005 yellowTAB GmbH. All Rights Reserverd.
|
* Copyright 2004-2005 yellowTAB GmbH. All Rights Reserved.
|
||||||
* Copyright 2006 Bernd Korz. All Rights Reserved
|
* Copyright 2006 Bernd Korz. All Rights Reserved
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
@@ -21,29 +21,33 @@
|
|||||||
|
|
||||||
|
|
||||||
// Implementation of FilterThread
|
// Implementation of FilterThread
|
||||||
FilterThread::FilterThread(Filter* filter, int32 i, int32 n, bool runInCurrentThread)
|
FilterThread::FilterThread(Filter* filter, int32 i, int32 n,
|
||||||
: fFilter(filter)
|
bool runInCurrentThread)
|
||||||
, fI(i)
|
:
|
||||||
, fN(n)
|
fFilter(filter),
|
||||||
|
fI(i),
|
||||||
|
fN(n)
|
||||||
{
|
{
|
||||||
if (runInCurrentThread) {
|
if (runInCurrentThread)
|
||||||
Run();
|
Run();
|
||||||
} else {
|
else {
|
||||||
thread_id tid;
|
thread_id tid;
|
||||||
tid = spawn_thread(worker_thread, "filter", suggest_thread_priority(B_STATUS_RENDERING), this);
|
tid = spawn_thread(worker_thread, "filter",
|
||||||
if (tid >= 0) {
|
suggest_thread_priority(B_STATUS_RENDERING), this);
|
||||||
|
if (tid >= 0)
|
||||||
resume_thread(tid);
|
resume_thread(tid);
|
||||||
} else {
|
else
|
||||||
delete this;
|
delete this;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FilterThread::~FilterThread()
|
FilterThread::~FilterThread()
|
||||||
{
|
{
|
||||||
fFilter->FilterThreadDone();
|
fFilter->FilterThreadDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
FilterThread::worker_thread(void* data)
|
FilterThread::worker_thread(void* data)
|
||||||
{
|
{
|
||||||
@@ -51,6 +55,7 @@ FilterThread::worker_thread(void* data)
|
|||||||
return thread->Run();
|
return thread->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
FilterThread::Run()
|
FilterThread::Run()
|
||||||
{
|
{
|
||||||
@@ -67,24 +72,25 @@ FilterThread::Run()
|
|||||||
new FilterThread(fFilter, i, fN);
|
new FilterThread(fFilter, i, fN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fFilter->GetBitmap()) {
|
if (fFilter->GetBitmap())
|
||||||
fFilter->Run(fI, fN);
|
fFilter->Run(fI, fN);
|
||||||
}
|
|
||||||
delete this;
|
delete this;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of Filter
|
// Implementation of Filter
|
||||||
Filter::Filter(BBitmap* image, BMessenger listener, uint32 what)
|
Filter::Filter(BBitmap* image, BMessenger listener, uint32 what)
|
||||||
: fListener(listener)
|
:
|
||||||
, fWhat(what)
|
fListener(listener),
|
||||||
, fStarted(false)
|
fWhat(what),
|
||||||
, fN(0)
|
fStarted(false),
|
||||||
, fNumberOfThreads(0)
|
fN(0),
|
||||||
, fIsRunning(false)
|
fNumberOfThreads(0),
|
||||||
, fSrcImage(image)
|
fIsRunning(false),
|
||||||
, fDestImageInitialized(false)
|
fSrcImage(image),
|
||||||
, fDestImage(NULL)
|
fDestImageInitialized(false),
|
||||||
|
fDestImage(NULL)
|
||||||
{
|
{
|
||||||
fCPUCount = NumberOfActiveCPUs();
|
fCPUCount = NumberOfActiveCPUs();
|
||||||
|
|
||||||
@@ -95,12 +101,14 @@ Filter::Filter(BBitmap* image, BMessenger listener, uint32 what)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Filter::~Filter()
|
Filter::~Filter()
|
||||||
{
|
{
|
||||||
delete fDestImage;
|
delete fDestImage;
|
||||||
delete_sem(fWaitForThreads);
|
delete_sem(fWaitForThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
Filter::GetBitmap()
|
Filter::GetBitmap()
|
||||||
{
|
{
|
||||||
@@ -111,6 +119,7 @@ Filter::GetBitmap()
|
|||||||
return fDestImage;
|
return fDestImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
Filter::DetachBitmap()
|
Filter::DetachBitmap()
|
||||||
{
|
{
|
||||||
@@ -119,6 +128,7 @@ Filter::DetachBitmap()
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Filter::Start(bool async)
|
Filter::Start(bool async)
|
||||||
{
|
{
|
||||||
@@ -136,11 +146,11 @@ Filter::Start(bool async)
|
|||||||
// start first filter thread
|
// start first filter thread
|
||||||
new FilterThread(this, 0, fN, !async);
|
new FilterThread(this, 0, fN, !async);
|
||||||
|
|
||||||
if (!async) {
|
if (!async)
|
||||||
Wait();
|
Wait();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Filter::Wait()
|
Filter::Wait()
|
||||||
{
|
{
|
||||||
@@ -152,6 +162,7 @@ Filter::Wait()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Filter::Stop()
|
Filter::Stop()
|
||||||
{
|
{
|
||||||
@@ -160,17 +171,20 @@ Filter::Stop()
|
|||||||
Wait();
|
Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Filter::IsRunning() const
|
Filter::IsRunning() const
|
||||||
{
|
{
|
||||||
return fIsRunning;
|
return fIsRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Filter::Completed()
|
Filter::Completed()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Filter::FilterThreadDone()
|
Filter::FilterThreadDone()
|
||||||
{
|
{
|
||||||
@@ -179,14 +193,15 @@ Filter::FilterThreadDone()
|
|||||||
delete fStopWatch; fStopWatch = NULL;
|
delete fStopWatch; fStopWatch = NULL;
|
||||||
#endif
|
#endif
|
||||||
Completed();
|
Completed();
|
||||||
if (fIsRunning) {
|
if (fIsRunning)
|
||||||
fListener.SendMessage(fWhat);
|
fListener.SendMessage(fWhat);
|
||||||
}
|
|
||||||
fIsRunning = false;
|
fIsRunning = false;
|
||||||
}
|
}
|
||||||
release_sem(fWaitForThreads);
|
release_sem(fWaitForThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Filter::FilterThreadInitFailed()
|
Filter::FilterThreadInitFailed()
|
||||||
{
|
{
|
||||||
@@ -197,38 +212,43 @@ Filter::FilterThreadInitFailed()
|
|||||||
release_sem_etc(fWaitForThreads, fN, 0);
|
release_sem_etc(fWaitForThreads, fN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Filter::IsBitmapValid(BBitmap* bitmap) const
|
Filter::IsBitmapValid(BBitmap* bitmap) const
|
||||||
{
|
{
|
||||||
return bitmap != NULL && bitmap->InitCheck() == B_OK && bitmap->IsValid();
|
return bitmap != NULL && bitmap->InitCheck() == B_OK && bitmap->IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
Filter::NumberOfThreads()
|
Filter::NumberOfThreads()
|
||||||
{
|
{
|
||||||
const int32 units = GetNumberOfUnits();
|
const int32 units = GetNumberOfUnits();
|
||||||
int32 n;
|
int32 n;
|
||||||
n = units / 32; // at least 32 units per CPU
|
n = units / 32; // at least 32 units per CPU
|
||||||
if (n > CPUCount()) {
|
if (n > CPUCount())
|
||||||
n = CPUCount();
|
n = CPUCount();
|
||||||
} else if (n <= 0) {
|
else if (n <= 0)
|
||||||
n = 1; // at least one thread!
|
n = 1; // at least one thread!
|
||||||
}
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
Filter::GetSrcImage()
|
Filter::GetSrcImage()
|
||||||
{
|
{
|
||||||
return fSrcImage;
|
return fSrcImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
Filter::GetDestImage()
|
Filter::GetDestImage()
|
||||||
{
|
{
|
||||||
return fDestImage;
|
return fDestImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
Filter::NumberOfActiveCPUs() const
|
Filter::NumberOfActiveCPUs() const
|
||||||
{
|
{
|
||||||
@@ -247,15 +267,19 @@ Filter::NumberOfActiveCPUs() const
|
|||||||
return cpuCount;
|
return cpuCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Implementation of (bilinear) Scaler
|
// Implementation of (bilinear) Scaler
|
||||||
Scaler::Scaler(BBitmap* image, BRect rect, BMessenger listener, uint32 what, bool dither)
|
Scaler::Scaler(BBitmap* image, BRect rect, BMessenger listener, uint32 what,
|
||||||
: Filter(image, listener, what)
|
bool dither)
|
||||||
, fScaledImage(NULL)
|
:
|
||||||
, fRect(rect)
|
Filter(image, listener, what),
|
||||||
, fDither(dither)
|
fScaledImage(NULL),
|
||||||
|
fRect(rect),
|
||||||
|
fDither(dither)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scaler::~Scaler()
|
Scaler::~Scaler()
|
||||||
{
|
{
|
||||||
if (GetDestImage() != fScaledImage) {
|
if (GetDestImage() != fScaledImage) {
|
||||||
@@ -264,13 +288,17 @@ Scaler::~Scaler()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
Scaler::CreateDestImage(BBitmap* srcImage)
|
Scaler::CreateDestImage(BBitmap* srcImage)
|
||||||
{
|
{
|
||||||
if (srcImage == NULL || (srcImage->ColorSpace() != B_RGB32 && srcImage->ColorSpace() != B_RGBA32)) return NULL;
|
if (srcImage == NULL || (srcImage->ColorSpace() != B_RGB32
|
||||||
|
&& srcImage->ColorSpace() != B_RGBA32))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
BRect dest(0, 0, fRect.IntegerWidth(), fRect.IntegerHeight());
|
BRect dest(0, 0, fRect.IntegerWidth(), fRect.IntegerHeight());
|
||||||
BBitmap* destImage = new BBitmap(dest, fDither ? B_CMAP8 : srcImage->ColorSpace());
|
BBitmap* destImage = new BBitmap(dest,
|
||||||
|
fDither ? B_CMAP8 : srcImage->ColorSpace());
|
||||||
|
|
||||||
if (!IsBitmapValid(destImage)) {
|
if (!IsBitmapValid(destImage)) {
|
||||||
delete destImage;
|
delete destImage;
|
||||||
@@ -287,19 +315,19 @@ Scaler::CreateDestImage(BBitmap* srcImage)
|
|||||||
fScaledImage = NULL;
|
fScaledImage = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
fScaledImage = destImage;
|
fScaledImage = destImage;
|
||||||
}
|
|
||||||
|
|
||||||
return destImage;
|
return destImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Scaler::Matches(BRect rect, bool dither) const
|
Scaler::Matches(BRect rect, bool dither) const
|
||||||
{
|
{
|
||||||
return fRect.IntegerWidth() == rect.IntegerWidth() &&
|
return fRect.IntegerWidth() == rect.IntegerWidth()
|
||||||
fRect.IntegerHeight() == rect.IntegerHeight() &&
|
&& fRect.IntegerHeight() == rect.IntegerHeight()
|
||||||
fDither == dither;
|
&& fDither == dither;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -310,6 +338,7 @@ typedef struct {
|
|||||||
float alpha1;
|
float alpha1;
|
||||||
} ColumnData;
|
} ColumnData;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::ScaleBilinear(intType fromRow, int32 toRow)
|
Scaler::ScaleBilinear(intType fromRow, int32 toRow)
|
||||||
{
|
{
|
||||||
@@ -343,7 +372,7 @@ Scaler::ScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
|
|
||||||
columnData = new ColumnData[destW];
|
columnData = new ColumnData[destW];
|
||||||
cd = columnData;
|
cd = columnData;
|
||||||
for (i = 0; i < destW; i ++, cd++) {
|
for (i = 0; i < destW; i++, cd++) {
|
||||||
float column = (float)i * (float)srcW / (float)destW;
|
float column = (float)i * (float)srcW / (float)destW;
|
||||||
cd->srcColumn = (intType)column;
|
cd->srcColumn = (intType)column;
|
||||||
cd->alpha1 = column - cd->srcColumn;
|
cd->alpha1 = column - cd->srcColumn;
|
||||||
@@ -352,16 +381,16 @@ Scaler::ScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
|
|
||||||
destDataRow = destBits + fromRow * destBPR;
|
destDataRow = destBits + fromRow * destBPR;
|
||||||
|
|
||||||
for (y = fromRow; IsRunning() && y <= toRow; y ++, destDataRow += destBPR) {
|
for (y = fromRow; IsRunning() && y <= toRow; y++, destDataRow += destBPR) {
|
||||||
float row;
|
float row;
|
||||||
intType srcRow;
|
intType srcRow;
|
||||||
float alpha0, alpha1;
|
float alpha0, alpha1;
|
||||||
|
|
||||||
if (destH == 0) {
|
if (destH == 0)
|
||||||
row = 0;
|
row = 0;
|
||||||
} else {
|
else
|
||||||
row = (float)y * (float)srcH / (float)destH;
|
row = (float)y * (float)srcH / (float)destH;
|
||||||
}
|
|
||||||
srcRow = (intType)row;
|
srcRow = (intType)row;
|
||||||
alpha1 = row - srcRow;
|
alpha1 = row - srcRow;
|
||||||
alpha0 = 1.0 - alpha1;
|
alpha0 = 1.0 - alpha1;
|
||||||
@@ -434,6 +463,7 @@ Scaler::ScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
delete[] columnData;
|
delete[] columnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Scale bilinear using fixed point calculations
|
// Scale bilinear using fixed point calculations
|
||||||
// Is already more than two times faster than floating point version
|
// Is already more than two times faster than floating point version
|
||||||
// on AMD Athlon 1 GHz and Dual Intel Pentium III 866 MHz.
|
// on AMD Athlon 1 GHz and Dual Intel Pentium III 866 MHz.
|
||||||
@@ -444,6 +474,7 @@ typedef struct {
|
|||||||
fixed_point alpha1;
|
fixed_point alpha1;
|
||||||
} ColumnDataFP;
|
} ColumnDataFP;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::ScaleBilinearFP(intType fromRow, int32 toRow)
|
Scaler::ScaleBilinearFP(intType fromRow, int32 toRow)
|
||||||
{
|
{
|
||||||
@@ -482,8 +513,9 @@ Scaler::ScaleBilinearFP(intType fromRow, int32 toRow)
|
|||||||
|
|
||||||
columnData = new ColumnDataFP[destW];
|
columnData = new ColumnDataFP[destW];
|
||||||
cd = columnData;
|
cd = columnData;
|
||||||
for (i = 0; i < destW; i ++, cd++) {
|
for (i = 0; i < destW; i++, cd++) {
|
||||||
fixed_point column = to_fixed_point(i) * (long_fixed_point)fpSrcW / fpDestW;
|
fixed_point column = to_fixed_point(i) * (long_fixed_point)fpSrcW
|
||||||
|
/ fpDestW;
|
||||||
cd->srcColumn = from_fixed_point(column);
|
cd->srcColumn = from_fixed_point(column);
|
||||||
cd->alpha1 = tail_value(column); // weigth for left pixel value
|
cd->alpha1 = tail_value(column); // weigth for left pixel value
|
||||||
cd->alpha0 = kFPOne - cd->alpha1; // weigth for right pixel value
|
cd->alpha0 = kFPOne - cd->alpha1; // weigth for right pixel value
|
||||||
@@ -491,18 +523,18 @@ Scaler::ScaleBilinearFP(intType fromRow, int32 toRow)
|
|||||||
|
|
||||||
destDataRow = destBits + fromRow * destBPR;
|
destDataRow = destBits + fromRow * destBPR;
|
||||||
|
|
||||||
for (y = fromRow; IsRunning() && y <= toRow; y ++, destDataRow += destBPR) {
|
for (y = fromRow; IsRunning() && y <= toRow; y++, destDataRow += destBPR) {
|
||||||
fixed_point row;
|
fixed_point row;
|
||||||
intType srcRow;
|
intType srcRow;
|
||||||
fixed_point alpha0, alpha1;
|
fixed_point alpha0, alpha1;
|
||||||
|
|
||||||
if (fpDestH == 0) {
|
if (fpDestH == 0)
|
||||||
row = 0;
|
row = 0;
|
||||||
} else {
|
else
|
||||||
row = to_fixed_point(y) * (long_fixed_point)fpSrcH / fpDestH;
|
row = to_fixed_point(y) * (long_fixed_point)fpSrcH / fpDestH;
|
||||||
}
|
|
||||||
srcRow = from_fixed_point(row);
|
srcRow = from_fixed_point(row);
|
||||||
alpha1 = tail_value(row); // weight for row y+1
|
alpha1 = tail_value(row); // weight for row y + 1
|
||||||
alpha0 = kFPOne - alpha1; // weight for row y
|
alpha0 = kFPOne - alpha1; // weight for row y
|
||||||
|
|
||||||
srcData = srcBits + srcRow * srcBPR;
|
srcData = srcBits + srcRow * srcBPR;
|
||||||
@@ -566,14 +598,15 @@ Scaler::ScaleBilinearFP(intType fromRow, int32 toRow)
|
|||||||
destData[2] = a[2];
|
destData[2] = a[2];
|
||||||
destData[3] = a[3];
|
destData[3] = a[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] columnData;
|
delete[] columnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::RowValues(float* sum, const uchar* src, intType srcW, intType fromX, intType toX, const float a0X, const float a1X, const int32 kBPP)
|
Scaler::RowValues(float* sum, const uchar* src, intType srcW, intType fromX,
|
||||||
|
intType toX, const float a0X, const float a1X, const int32 kBPP)
|
||||||
{
|
{
|
||||||
sum[0] = a0X * src[0];
|
sum[0] = a0X * src[0];
|
||||||
sum[1] = a0X * src[1];
|
sum[1] = a0X * src[1];
|
||||||
@@ -581,7 +614,7 @@ Scaler::RowValues(float* sum, const uchar* src, intType srcW, intType fromX, int
|
|||||||
|
|
||||||
src += kBPP;
|
src += kBPP;
|
||||||
|
|
||||||
for (int32 x = fromX+1; x < toX; x ++, src += kBPP) {
|
for (int32 x = fromX + 1; x < toX; x++, src += kBPP) {
|
||||||
sum[0] += src[0];
|
sum[0] += src[0];
|
||||||
sum[1] += src[1];
|
sum[1] += src[1];
|
||||||
sum[2] += src[2];
|
sum[2] += src[2];
|
||||||
@@ -594,6 +627,7 @@ Scaler::RowValues(float* sum, const uchar* src, intType srcW, intType fromX, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32 from;
|
int32 from;
|
||||||
int32 to;
|
int32 to;
|
||||||
@@ -601,6 +635,7 @@ typedef struct {
|
|||||||
float alpha1;
|
float alpha1;
|
||||||
} DownScaleColumnData;
|
} DownScaleColumnData;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::DownScaleBilinear(intType fromRow, int32 toRow)
|
Scaler::DownScaleBilinear(intType fromRow, int32 toRow)
|
||||||
{
|
{
|
||||||
@@ -637,9 +672,9 @@ Scaler::DownScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
const float deltaY = (srcH + 1.0) / (destH + 1.0);
|
const float deltaY = (srcH + 1.0) / (destH + 1.0);
|
||||||
const float deltaXY = deltaX * deltaY;
|
const float deltaXY = deltaX * deltaY;
|
||||||
|
|
||||||
columnData = new DownScaleColumnData[destW+1];
|
columnData = new DownScaleColumnData[destW + 1];
|
||||||
DownScaleColumnData* cd = columnData;
|
DownScaleColumnData* cd = columnData;
|
||||||
for (x = 0; x <= destW; x ++, cd ++) {
|
for (x = 0; x <= destW; x++, cd++) {
|
||||||
const float fFromX = x * deltaX;
|
const float fFromX = x * deltaX;
|
||||||
const float fToX = fFromX + deltaX;
|
const float fToX = fFromX + deltaX;
|
||||||
|
|
||||||
@@ -664,7 +699,7 @@ Scaler::DownScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
destData = destDataRow;
|
destData = destDataRow;
|
||||||
|
|
||||||
cd = columnData;
|
cd = columnData;
|
||||||
for (x = 0; x <= destW; x ++, destData += kBPP, cd ++) {
|
for (x = 0; x <= destW; x++, destData += kBPP, cd++) {
|
||||||
const intType fromX = cd->from;
|
const intType fromX = cd->from;
|
||||||
const intType toX = cd->to;
|
const intType toX = cd->to;
|
||||||
|
|
||||||
@@ -683,7 +718,7 @@ Scaler::DownScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
|
|
||||||
srcData += srcBPR;
|
srcData += srcBPR;
|
||||||
|
|
||||||
for (int32 r = fromY+1; r < toY; r ++, srcData += srcBPR) {
|
for (int32 r = fromY + 1; r < toY; r++, srcData += srcBPR) {
|
||||||
RowValues(sum, srcData, srcW, fromX, toX, a0X, a1X, kBPP);
|
RowValues(sum, srcData, srcW, fromX, toX, a0X, a1X, kBPP);
|
||||||
totalSum[0] += sum[0];
|
totalSum[0] += sum[0];
|
||||||
totalSum[1] += sum[1];
|
totalSum[1] += sum[1];
|
||||||
@@ -706,6 +741,7 @@ Scaler::DownScaleBilinear(intType fromRow, int32 toRow)
|
|||||||
delete[] columnData;
|
delete[] columnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Flyod-Steinberg Dithering
|
// Flyod-Steinberg Dithering
|
||||||
// Filter (distribution of error to adjacent pixels, X is current pixel):
|
// Filter (distribution of error to adjacent pixels, X is current pixel):
|
||||||
// 0 X 7
|
// 0 X 7
|
||||||
@@ -715,6 +751,7 @@ typedef struct {
|
|||||||
intType error[3];
|
intType error[3];
|
||||||
} DitheringColumnData;
|
} DitheringColumnData;
|
||||||
|
|
||||||
|
|
||||||
uchar
|
uchar
|
||||||
Scaler::Limit(intType value)
|
Scaler::Limit(intType value)
|
||||||
{
|
{
|
||||||
@@ -726,6 +763,7 @@ Scaler::Limit(intType value)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::Dither(int32 fromRow, int32 toRow)
|
Scaler::Dither(int32 fromRow, int32 toRow)
|
||||||
{
|
{
|
||||||
@@ -766,19 +804,20 @@ Scaler::Dither(int32 fromRow, int32 toRow)
|
|||||||
destBPR = dest->BytesPerRow();
|
destBPR = dest->BytesPerRow();
|
||||||
|
|
||||||
// Allocate space for sentinel at left and right bounds,
|
// Allocate space for sentinel at left and right bounds,
|
||||||
// so that columnData[-1] and columnData[destW+1] can be safely accessed
|
// so that columnData[-1] and columnData[destW + 1] can be safely accessed
|
||||||
columnData0 = new DitheringColumnData[destW+3];
|
columnData0 = new DitheringColumnData[destW + 3];
|
||||||
columnData = columnData0 + 1;
|
columnData = columnData0 + 1;
|
||||||
|
|
||||||
// clear error
|
// clear error
|
||||||
cd = columnData;
|
cd = columnData;
|
||||||
for (x = destW; x >= 0; x --, cd ++) {
|
for (x = destW; x >= 0; x --, cd++) {
|
||||||
cd->error[0] = cd->error[1] = cd->error[2] =0;
|
cd->error[0] = cd->error[1] = cd->error[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcDataRow = srcBits + fromRow * srcBPR;
|
srcDataRow = srcBits + fromRow * srcBPR;
|
||||||
destDataRow = destBits + fromRow * destBPR;
|
destDataRow = destBits + fromRow * destBPR;
|
||||||
for (y = fromRow; IsRunning() && y <= toRow; y ++, srcDataRow += srcBPR, destDataRow += destBPR) {
|
for (y = fromRow; IsRunning() && y <= toRow; y++, srcDataRow += srcBPR,
|
||||||
|
destDataRow += destBPR) {
|
||||||
// left to right
|
// left to right
|
||||||
error[0] = error[1] = error[2] = 0;
|
error[0] = error[1] = error[2] = 0;
|
||||||
srcData = srcDataRow;
|
srcData = srcDataRow;
|
||||||
@@ -797,12 +836,12 @@ Scaler::Dither(int32 fromRow, int32 toRow)
|
|||||||
*destData = index;
|
*destData = index;
|
||||||
|
|
||||||
err[0] = color.red - actualColor.red;
|
err[0] = color.red - actualColor.red;
|
||||||
err[1] = color.green -actualColor.green;
|
err[1] = color.green - actualColor.green;
|
||||||
err[2] = color.blue -actualColor.blue;
|
err[2] = color.blue - actualColor.blue;
|
||||||
|
|
||||||
// distribute error
|
// distribute error
|
||||||
// get error for next pixel
|
// get error for next pixel
|
||||||
cd = &columnData[x+1];
|
cd = &columnData[x + 1];
|
||||||
error[0] = cd->error[0] + 7 * err[0];
|
error[0] = cd->error[0] + 7 * err[0];
|
||||||
error[1] = cd->error[1] + 7 * err[1];
|
error[1] = cd->error[1] + 7 * err[1];
|
||||||
error[2] = cd->error[2] + 7 * err[2];
|
error[2] = cd->error[2] + 7 * err[2];
|
||||||
@@ -813,27 +852,27 @@ Scaler::Dither(int32 fromRow, int32 toRow)
|
|||||||
cd->error[2] = err[2];
|
cd->error[2] = err[2];
|
||||||
|
|
||||||
// add error for pixel below current pixel
|
// add error for pixel below current pixel
|
||||||
cd --;
|
cd--;
|
||||||
cd->error[0] += 5 * err[0];
|
cd->error[0] += 5 * err[0];
|
||||||
cd->error[1] += 5 * err[1];
|
cd->error[1] += 5 * err[1];
|
||||||
cd->error[2] += 5 * err[2];
|
cd->error[2] += 5 * err[2];
|
||||||
|
|
||||||
// add error for left pixel below current pixel
|
// add error for left pixel below current pixel
|
||||||
cd --;
|
cd--;
|
||||||
cd->error[0] += 3 * err[0];
|
cd->error[0] += 3 * err[0];
|
||||||
cd->error[1] += 3 * err[1];
|
cd->error[1] += 3 * err[1];
|
||||||
cd->error[2] += 3 * err[2];
|
cd->error[2] += 3 * err[2];
|
||||||
}
|
}
|
||||||
// Note: Alogrithm has good results with "left to right" already
|
// Note: Alogrithm has good results with "left to right" already
|
||||||
// Optionally remove code to end of block:
|
// Optionally remove code to end of block:
|
||||||
y ++;
|
y++;
|
||||||
srcDataRow += srcBPR; destDataRow += destBPR;
|
srcDataRow += srcBPR; destDataRow += destBPR;
|
||||||
if (y > toRow) break;
|
if (y > toRow) break;
|
||||||
// right to left
|
// right to left
|
||||||
error[0] = error[1] = error[2] = 0;
|
error[0] = error[1] = error[2] = 0;
|
||||||
srcData = srcDataRow + destW * kBPP;
|
srcData = srcDataRow + destW * kBPP;
|
||||||
destData = destDataRow + destW;
|
destData = destDataRow + destW;
|
||||||
for (x = 0; x <= destW; x ++, srcData -= kBPP, destData -= 1) {
|
for (x = 0; x <= destW; x++, srcData -= kBPP, destData -= 1) {
|
||||||
rgb_color color, actualColor;
|
rgb_color color, actualColor;
|
||||||
uint8 index;
|
uint8 index;
|
||||||
|
|
||||||
@@ -847,12 +886,12 @@ Scaler::Dither(int32 fromRow, int32 toRow)
|
|||||||
*destData = index;
|
*destData = index;
|
||||||
|
|
||||||
err[0] = color.red - actualColor.red;
|
err[0] = color.red - actualColor.red;
|
||||||
err[1] = color.green -actualColor.green;
|
err[1] = color.green - actualColor.green;
|
||||||
err[2] = color.blue -actualColor.blue;
|
err[2] = color.blue - actualColor.blue;
|
||||||
|
|
||||||
// distribute error
|
// distribute error
|
||||||
// get error for next pixel
|
// get error for next pixel
|
||||||
cd = &columnData[x-1];
|
cd = &columnData[x - 1];
|
||||||
error[0] = cd->error[0] + 7 * err[0];
|
error[0] = cd->error[0] + 7 * err[0];
|
||||||
error[1] = cd->error[1] + 7 * err[1];
|
error[1] = cd->error[1] + 7 * err[1];
|
||||||
error[2] = cd->error[2] + 7 * err[2];
|
error[2] = cd->error[2] + 7 * err[2];
|
||||||
@@ -863,13 +902,13 @@ Scaler::Dither(int32 fromRow, int32 toRow)
|
|||||||
cd->error[2] = err[2];
|
cd->error[2] = err[2];
|
||||||
|
|
||||||
// add error for pixel below current pixel
|
// add error for pixel below current pixel
|
||||||
cd ++;
|
cd++;
|
||||||
cd->error[0] += 5 * err[0];
|
cd->error[0] += 5 * err[0];
|
||||||
cd->error[1] += 5 * err[1];
|
cd->error[1] += 5 * err[1];
|
||||||
cd->error[2] += 5 * err[2];
|
cd->error[2] += 5 * err[2];
|
||||||
|
|
||||||
// add error for right pixel below current pixel
|
// add error for right pixel below current pixel
|
||||||
cd ++;
|
cd++;
|
||||||
cd->error[0] += 3 * err[0];
|
cd->error[0] += 3 * err[0];
|
||||||
cd->error[1] += 3 * err[1];
|
cd->error[1] += 3 * err[1];
|
||||||
cd->error[2] += 3 * err[2];
|
cd->error[2] += 3 * err[2];
|
||||||
@@ -879,12 +918,14 @@ Scaler::Dither(int32 fromRow, int32 toRow)
|
|||||||
delete[] columnData0;
|
delete[] columnData0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
Scaler::GetNumberOfUnits()
|
Scaler::GetNumberOfUnits()
|
||||||
{
|
{
|
||||||
return fRect.IntegerHeight() + 1;
|
return fRect.IntegerHeight() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::Run(int32 i, int32 n)
|
Scaler::Run(int32 i, int32 n)
|
||||||
{
|
{
|
||||||
@@ -892,43 +933,47 @@ Scaler::Run(int32 i, int32 n)
|
|||||||
imageHeight = GetDestImage()->Bounds().IntegerHeight() + 1;
|
imageHeight = GetDestImage()->Bounds().IntegerHeight() + 1;
|
||||||
height = imageHeight / n;
|
height = imageHeight / n;
|
||||||
from = i * height;
|
from = i * height;
|
||||||
if (i+1 == n) {
|
if (i + 1 == n)
|
||||||
to = imageHeight - 1;
|
to = imageHeight - 1;
|
||||||
} else {
|
else
|
||||||
to = from + height - 1;
|
to = from + height - 1;
|
||||||
}
|
|
||||||
if (GetDestImage()->Bounds().Width() >= GetSrcImage()->Bounds().Width()) {
|
if (GetDestImage()->Bounds().Width() >= GetSrcImage()->Bounds().Width())
|
||||||
ScaleBilinearFP(from, to);
|
ScaleBilinearFP(from, to);
|
||||||
} else {
|
else
|
||||||
DownScaleBilinear(from, to);
|
DownScaleBilinear(from, to);
|
||||||
}
|
|
||||||
if (fDither) {
|
if (fDither)
|
||||||
Dither(from, to);
|
Dither(from, to);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scaler::Completed()
|
Scaler::Completed()
|
||||||
{
|
{
|
||||||
if (GetDestImage() != fScaledImage) {
|
if (GetDestImage() != fScaledImage)
|
||||||
delete fScaledImage;
|
delete fScaledImage;
|
||||||
}
|
|
||||||
fScaledImage = NULL;
|
fScaledImage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of ImageProcessor
|
|
||||||
ImageProcessor::ImageProcessor(enum operation op, BBitmap* image, BMessenger listener, uint32 what)
|
|
||||||
: Filter(image, listener, what)
|
|
||||||
, fOp(op)
|
|
||||||
, fBPP(0)
|
|
||||||
, fWidth(0)
|
|
||||||
, fHeight(0)
|
|
||||||
, fSrcBPR(0)
|
|
||||||
, fDestBPR(0)
|
|
||||||
|
|
||||||
|
// Implementation of ImageProcessor
|
||||||
|
ImageProcessor::ImageProcessor(enum operation op, BBitmap* image,
|
||||||
|
BMessenger listener, uint32 what)
|
||||||
|
:
|
||||||
|
Filter(image, listener, what),
|
||||||
|
fOp(op),
|
||||||
|
fBPP(0),
|
||||||
|
fWidth(0),
|
||||||
|
fHeight(0),
|
||||||
|
fSrcBPR(0),
|
||||||
|
fDestBPR(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
ImageProcessor::CreateDestImage(BBitmap* /* srcImage */)
|
ImageProcessor::CreateDestImage(BBitmap* /* srcImage */)
|
||||||
{
|
{
|
||||||
@@ -936,20 +981,21 @@ ImageProcessor::CreateDestImage(BBitmap* /* srcImage */)
|
|||||||
BBitmap* bm;
|
BBitmap* bm;
|
||||||
BRect rect;
|
BRect rect;
|
||||||
|
|
||||||
if (GetSrcImage() == NULL) return NULL;
|
if (GetSrcImage() == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
cs = GetSrcImage()->ColorSpace();
|
cs = GetSrcImage()->ColorSpace();
|
||||||
fBPP = BytesPerPixel(cs);
|
fBPP = BytesPerPixel(cs);
|
||||||
if (fBPP < 1) return NULL;
|
if (fBPP < 1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
fWidth = GetSrcImage()->Bounds().IntegerWidth();
|
fWidth = GetSrcImage()->Bounds().IntegerWidth();
|
||||||
fHeight = GetSrcImage()->Bounds().IntegerHeight();
|
fHeight = GetSrcImage()->Bounds().IntegerHeight();
|
||||||
|
|
||||||
if (fOp == kRotateClockwise || fOp == kRotateCounterClockwise) {
|
if (fOp == kRotateClockwise || fOp == kRotateCounterClockwise)
|
||||||
rect.Set(0, 0, fHeight, fWidth);
|
rect.Set(0, 0, fHeight, fWidth);
|
||||||
} else {
|
else
|
||||||
rect.Set(0, 0, fWidth, fHeight);
|
rect.Set(0, 0, fWidth, fHeight);
|
||||||
}
|
|
||||||
|
|
||||||
bm = new BBitmap(rect, cs);
|
bm = new BBitmap(rect, cs);
|
||||||
if (!IsBitmapValid(bm)) {
|
if (!IsBitmapValid(bm)) {
|
||||||
@@ -963,45 +1009,50 @@ ImageProcessor::CreateDestImage(BBitmap* /* srcImage */)
|
|||||||
return bm;
|
return bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
ImageProcessor::GetNumberOfUnits()
|
ImageProcessor::GetNumberOfUnits()
|
||||||
{
|
{
|
||||||
return GetSrcImage()->Bounds().IntegerHeight() + 1;
|
return GetSrcImage()->Bounds().IntegerHeight() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
ImageProcessor::BytesPerPixel(color_space cs) const
|
ImageProcessor::BytesPerPixel(color_space cs) const
|
||||||
{
|
{
|
||||||
switch (cs) {
|
switch (cs) {
|
||||||
case B_RGB32: // fall through
|
case B_RGB32: // fall through
|
||||||
case B_RGB32_BIG: // fall through
|
case B_RGB32_BIG: // fall through
|
||||||
case B_RGBA32: // fall through
|
case B_RGBA32: // fall through
|
||||||
case B_RGBA32_BIG: return 4;
|
case B_RGBA32_BIG: return 4;
|
||||||
|
|
||||||
case B_RGB24_BIG: // fall through
|
case B_RGB24_BIG: // fall through
|
||||||
case B_RGB24: return 3;
|
case B_RGB24: return 3;
|
||||||
|
|
||||||
case B_RGB16: // fall through
|
case B_RGB16: // fall through
|
||||||
case B_RGB16_BIG: // fall through
|
case B_RGB16_BIG: // fall through
|
||||||
case B_RGB15: // fall through
|
case B_RGB15: // fall through
|
||||||
case B_RGB15_BIG: // fall through
|
case B_RGB15_BIG: // fall through
|
||||||
case B_RGBA15: // fall through
|
case B_RGBA15: // fall through
|
||||||
case B_RGBA15_BIG: return 2;
|
case B_RGBA15_BIG: return 2;
|
||||||
|
|
||||||
case B_GRAY8: // fall through
|
case B_GRAY8: // fall through
|
||||||
case B_CMAP8: return 1;
|
case B_CMAP8: return 1;
|
||||||
case B_GRAY1: return 0;
|
case B_GRAY1: return 0;
|
||||||
default: return -1;
|
default: return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageProcessor::CopyPixel(uchar* dest, int32 destX, int32 destY, const uchar* src, int32 x, int32 y)
|
ImageProcessor::CopyPixel(uchar* dest, int32 destX, int32 destY,
|
||||||
|
const uchar* src, int32 x, int32 y)
|
||||||
{
|
{
|
||||||
// Note: On my systems (Dual Intel P3 866MHz and AMD Athlon 1GHz), replacing
|
// Note: On my systems (Dual Intel P3 866MHz and AMD Athlon 1GHz),
|
||||||
// the multiplications below with pointer arithmethics showed no speedup at all!
|
// replacing the multiplications below with pointer arithmethics showed
|
||||||
|
// no speedup at all!
|
||||||
dest += fDestBPR * destY + destX * fBPP;
|
dest += fDestBPR * destY + destX * fBPP;
|
||||||
src += fSrcBPR * y + x *fBPP;
|
src += fSrcBPR * y + x * fBPP;
|
||||||
// Replacing memcpy with this switch statement is slightly faster
|
// Replacing memcpy with this switch statement is slightly faster
|
||||||
switch (fBPP) {
|
switch (fBPP) {
|
||||||
case 4:
|
case 4:
|
||||||
@@ -1016,6 +1067,7 @@ ImageProcessor::CopyPixel(uchar* dest, int32 destX, int32 destY, const uchar* sr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Note: For B_CMAP8 InvertPixel inverts the color index not the color value!
|
// Note: For B_CMAP8 InvertPixel inverts the color index not the color value!
|
||||||
void
|
void
|
||||||
ImageProcessor::InvertPixel(int32 x, int32 y, uchar* dest, const uchar* src)
|
ImageProcessor::InvertPixel(int32 x, int32 y, uchar* dest, const uchar* src)
|
||||||
@@ -1035,18 +1087,19 @@ ImageProcessor::InvertPixel(int32 x, int32 y, uchar* dest, const uchar* src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: On my systems, the operation kInvert shows a speedup on multiple CPUs only!
|
|
||||||
|
// Note: On my systems, the operation kInvert shows a speedup on
|
||||||
|
// multiple CPUs only!
|
||||||
void
|
void
|
||||||
ImageProcessor::Run(int32 i, int32 n)
|
ImageProcessor::Run(int32 i, int32 n)
|
||||||
{
|
{
|
||||||
int32 from, to;
|
int32 from, to;
|
||||||
int32 height = (fHeight+1) / n;
|
int32 height = (fHeight + 1) / n;
|
||||||
from = i * height;
|
from = i * height;
|
||||||
if (i+1 == n) {
|
if (i + 1 == n)
|
||||||
to = fHeight;
|
to = fHeight;
|
||||||
} else {
|
else
|
||||||
to = from + height - 1;
|
to = from + height - 1;
|
||||||
}
|
|
||||||
|
|
||||||
int32 x, y, destX, destY;
|
int32 x, y, destX, destY;
|
||||||
const uchar* src = (uchar*)GetSrcImage()->Bits();
|
const uchar* src = (uchar*)GetSrcImage()->Bits();
|
||||||
@@ -1054,8 +1107,8 @@ ImageProcessor::Run(int32 i, int32 n)
|
|||||||
|
|
||||||
switch (fOp) {
|
switch (fOp) {
|
||||||
case kRotateClockwise:
|
case kRotateClockwise:
|
||||||
for (y = from; y <= to; y ++) {
|
for (y = from; y <= to; y++) {
|
||||||
for (x = 0; x <= fWidth; x ++) {
|
for (x = 0; x <= fWidth; x++) {
|
||||||
destX = fHeight - y;
|
destX = fHeight - y;
|
||||||
destY = x;
|
destY = x;
|
||||||
CopyPixel(dest, destX, destY, src, x, y);
|
CopyPixel(dest, destX, destY, src, x, y);
|
||||||
@@ -1097,5 +1150,4 @@ ImageProcessor::Run(int32 i, int32 n)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-20
@@ -63,16 +63,17 @@ const int32 kFPOne = to_fixed_point(1);
|
|||||||
// Used by class Filter
|
// Used by class Filter
|
||||||
class FilterThread {
|
class FilterThread {
|
||||||
public:
|
public:
|
||||||
FilterThread(Filter* filter, int32 i, int32 n, bool runInCurrentThread = false);
|
FilterThread(Filter* filter, int32 i, int32 n,
|
||||||
|
bool runInCurrentThread = false);
|
||||||
~FilterThread();
|
~FilterThread();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t Run();
|
status_t Run();
|
||||||
static status_t worker_thread(void* data);
|
static status_t worker_thread(void* data);
|
||||||
|
|
||||||
Filter* fFilter;
|
Filter* fFilter;
|
||||||
int32 fI;
|
int32 fI;
|
||||||
int32 fN;
|
int32 fN;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Filter {
|
class Filter {
|
||||||
@@ -142,26 +143,27 @@ private:
|
|||||||
// Returns the number of active CPUs
|
// Returns the number of active CPUs
|
||||||
int32 CPUCount() const { return fCPUCount; }
|
int32 CPUCount() const { return fCPUCount; }
|
||||||
|
|
||||||
BMessenger fListener;
|
BMessenger fListener;
|
||||||
uint32 fWhat;
|
uint32 fWhat;
|
||||||
int32 fCPUCount; // the number of active CPUs
|
int32 fCPUCount; // the number of active CPUs
|
||||||
bool fStarted; // has Start() been called?
|
bool fStarted; // has Start() been called?
|
||||||
sem_id fWaitForThreads; // to exit
|
sem_id fWaitForThreads; // to exit
|
||||||
int32 fN; // the number of used filter threads
|
int32 fN; // the number of used filter threads
|
||||||
volatile int32 fNumberOfThreads; // the current number of FilterThreads
|
volatile int32 fNumberOfThreads; // the current number of FilterThreads
|
||||||
volatile bool fIsRunning; // FilterThreads should process data as long as it is true
|
volatile bool fIsRunning; // FilterThreads should process data as long as it is true
|
||||||
BBitmap* fSrcImage;
|
BBitmap* fSrcImage;
|
||||||
bool fDestImageInitialized;
|
bool fDestImageInitialized;
|
||||||
BBitmap* fDestImage;
|
BBitmap* fDestImage;
|
||||||
#if TIME_FILTER
|
#if TIME_FILTER
|
||||||
BStopWatch* fStopWatch;
|
BStopWatch* fStopWatch;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Scales and optionally dithers an image
|
// Scales and optionally dithers an image
|
||||||
class Scaler : public Filter {
|
class Scaler : public Filter {
|
||||||
public:
|
public:
|
||||||
Scaler(BBitmap* image, BRect rect, BMessenger listener, uint32 what, bool dither);
|
Scaler(BBitmap* image, BRect rect, BMessenger listener, uint32 what,
|
||||||
|
bool dither);
|
||||||
~Scaler();
|
~Scaler();
|
||||||
|
|
||||||
BBitmap* CreateDestImage(BBitmap* srcImage);
|
BBitmap* CreateDestImage(BBitmap* srcImage);
|
||||||
@@ -173,7 +175,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void ScaleBilinear(int32 fromRow, int32 toRow);
|
void ScaleBilinear(int32 fromRow, int32 toRow);
|
||||||
void ScaleBilinearFP(int32 fromRow, int32 toRow);
|
void ScaleBilinearFP(int32 fromRow, int32 toRow);
|
||||||
inline void RowValues(float* sum, const uchar* srcData, intType srcW, intType fromX, intType toX, const float a0X, const float a1X, const int32 kBPP);
|
inline void RowValues(float* sum, const uchar* srcData, intType srcW,
|
||||||
|
intType fromX, intType toX, const float a0X,
|
||||||
|
const float a1X, const int32 kBPP);
|
||||||
void DownScaleBilinear(int32 fromRow, int32 toRow);
|
void DownScaleBilinear(int32 fromRow, int32 toRow);
|
||||||
static inline uchar Limit(intType value);
|
static inline uchar Limit(intType value);
|
||||||
void Dither(int32 fromRow, int32 toRow);
|
void Dither(int32 fromRow, int32 toRow);
|
||||||
@@ -195,14 +199,16 @@ public:
|
|||||||
kNumberOfAffineTransformations = 4
|
kNumberOfAffineTransformations = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageProcessor(enum operation op, BBitmap* image, BMessenger listener, uint32 what);
|
ImageProcessor(enum operation op, BBitmap* image, BMessenger listener,
|
||||||
|
uint32 what);
|
||||||
BBitmap* CreateDestImage(BBitmap* srcImage);
|
BBitmap* CreateDestImage(BBitmap* srcImage);
|
||||||
int32 GetNumberOfUnits();
|
int32 GetNumberOfUnits();
|
||||||
void Run(int32 i, int32 n);
|
void Run(int32 i, int32 n);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 BytesPerPixel(color_space cs) const;
|
int32 BytesPerPixel(color_space cs) const;
|
||||||
inline void CopyPixel(uchar* dest, int32 destX, int32 destY, const uchar* src, int32 x, int32 y);
|
inline void CopyPixel(uchar* dest, int32 destX, int32 destY,
|
||||||
|
const uchar* src, int32 x, int32 y);
|
||||||
inline void InvertPixel(int32 x, int32 y, uchar* dest, const uchar* src);
|
inline void InvertPixel(int32 x, int32 y, uchar* dest, const uchar* src);
|
||||||
|
|
||||||
enum operation fOp;
|
enum operation fOp;
|
||||||
|
|||||||
@@ -374,14 +374,16 @@ AutoAdjustingNavigator::~AutoAdjustingNavigator()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AutoAdjustingNavigator::FindNextImage(const entry_ref& currentRef, entry_ref& nextRef,
|
AutoAdjustingNavigator::FindNextImage(const entry_ref& currentRef,
|
||||||
bool next, bool rewind)
|
entry_ref& nextRef, bool next, bool rewind)
|
||||||
{
|
{
|
||||||
if (_CheckForTracker(currentRef))
|
if (_CheckForTracker(currentRef))
|
||||||
return fTrackerNavigator->FindNextImage(currentRef, nextRef, next, rewind);
|
return fTrackerNavigator->FindNextImage(currentRef, nextRef, next,
|
||||||
|
rewind);
|
||||||
|
|
||||||
if (fFolderNavigator != NULL)
|
if (fFolderNavigator != NULL)
|
||||||
return fFolderNavigator->FindNextImage(currentRef, nextRef, next, rewind);
|
return fFolderNavigator->FindNextImage(currentRef, nextRef, next,
|
||||||
|
rewind);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,10 @@
|
|||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
|
||||||
#include <GridLayoutBuilder.h>
|
#include <GridLayoutBuilder.h>
|
||||||
#include <Locale.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include "ShowImageConstants.h"
|
#include "ShowImageConstants.h"
|
||||||
@@ -73,7 +73,7 @@ PrintOptions::SetWidth(float w)
|
|||||||
void
|
void
|
||||||
PrintOptions::SetHeight(float h)
|
PrintOptions::SetHeight(float h)
|
||||||
{
|
{
|
||||||
fWidth = (fBounds.Width()+1) * h / (fBounds.Height()+1);
|
fWidth = (fBounds.Width() + 1) * h / (fBounds.Height() + 1);
|
||||||
fHeight = h;
|
fHeight = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ ProgressWindow::ProgressWindow()
|
|||||||
{
|
{
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
|
|
||||||
BView *view = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
|
BView* view = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(view);
|
AddChild(view);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ ProgressWindow::Stop()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ProgressWindow::MessageReceived(BMessage *message)
|
ProgressWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kMsgShow:
|
case kMsgShow:
|
||||||
@@ -123,7 +123,7 @@ ProgressWindow::MessageReceived(BMessage *message)
|
|||||||
if (message->FindFloat("percent", &percent) == B_OK)
|
if (message->FindFloat("percent", &percent) == B_OK)
|
||||||
fStatusBar->Update(percent - fStatusBar->CurrentValue());
|
fStatusBar->Update(percent - fStatusBar->CurrentValue());
|
||||||
|
|
||||||
const char *text;
|
const char* text;
|
||||||
if (message->FindString("message", &text) == B_OK)
|
if (message->FindString("message", &text) == B_OK)
|
||||||
fStatusBar->SetText(text);
|
fStatusBar->SetText(text);
|
||||||
|
|
||||||
|
|||||||
@@ -109,13 +109,13 @@ SelectionBox::Animate()
|
|||||||
{
|
{
|
||||||
// rotate up
|
// rotate up
|
||||||
uchar p = fPatternUp.data[0];
|
uchar p = fPatternUp.data[0];
|
||||||
for (int i = 0; i <= 6; i ++)
|
for (int i = 0; i <= 6; i++)
|
||||||
fPatternUp.data[i] = fPatternUp.data[i + 1];
|
fPatternUp.data[i] = fPatternUp.data[i + 1];
|
||||||
fPatternUp.data[7] = p;
|
fPatternUp.data[7] = p;
|
||||||
|
|
||||||
// rotate down
|
// rotate down
|
||||||
p = fPatternDown.data[7];
|
p = fPatternDown.data[7];
|
||||||
for (int i = 7; i >= 1; i --)
|
for (int i = 7; i >= 1; i--)
|
||||||
fPatternDown.data[i] = fPatternDown.data[i - 1];
|
fPatternDown.data[i] = fPatternDown.data[i - 1];
|
||||||
fPatternDown.data[0] = p;
|
fPatternDown.data[0] = p;
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ SelectionBox::_InitPatterns()
|
|||||||
uchar p;
|
uchar p;
|
||||||
uchar p1 = 0x33;
|
uchar p1 = 0x33;
|
||||||
uchar p2 = 0xCC;
|
uchar p2 = 0xCC;
|
||||||
for (int i = 0; i <= 7; i ++) {
|
for (int i = 0; i <= 7; i++) {
|
||||||
fPatternLeft.data[i] = p1;
|
fPatternLeft.data[i] = p1;
|
||||||
fPatternRight.data[i] = p2;
|
fPatternRight.data[i] = p2;
|
||||||
if ((i / 2) % 2 == 0)
|
if ((i / 2) % 2 == 0)
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ void
|
|||||||
ShowImageApp::_BroadcastToWindows(BMessage* message)
|
ShowImageApp::_BroadcastToWindows(BMessage* message)
|
||||||
{
|
{
|
||||||
const int32 count = CountWindows();
|
const int32 count = CountWindows();
|
||||||
for (int32 i = 0; i < count; i ++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
// BMessenger checks for us if BWindow is still a valid object
|
// BMessenger checks for us if BWindow is still a valid object
|
||||||
BMessenger messenger(WindowAt(i));
|
BMessenger messenger(WindowAt(i));
|
||||||
messenger.SendMessage(message);
|
messenger.SendMessage(message);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ ShowImageUndo::SendUndoStateMessage(bool bCanUndo)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageUndo::SetTo(BRect rect, BBitmap *restore, BBitmap *selection)
|
ShowImageUndo::SetTo(BRect rect, BBitmap* restore, BBitmap* selection)
|
||||||
{
|
{
|
||||||
// NOTE: THIS FUNCTION DOES NOT MAKE COPIES OF THE BITMAPS PASSED TO IT
|
// NOTE: THIS FUNCTION DOES NOT MAKE COPIES OF THE BITMAPS PASSED TO IT
|
||||||
InternalClear();
|
InternalClear();
|
||||||
@@ -79,7 +79,7 @@ ShowImageUndo::SetTo(BRect rect, BBitmap *restore, BBitmap *selection)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageUndo::Undo(BRect rect, BBitmap *restore, BBitmap *selection)
|
ShowImageUndo::Undo(BRect rect, BBitmap* restore, BBitmap* selection)
|
||||||
{
|
{
|
||||||
// NOTE: THIS FUNCTION DOES NOT MAKE COPIES OF THE BITMAPS PASSED TO IT
|
// NOTE: THIS FUNCTION DOES NOT MAKE COPIES OF THE BITMAPS PASSED TO IT
|
||||||
fUndoType = UNDO_REDO;
|
fUndoType = UNDO_REDO;
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ ShowImageView::fTransformation[ImageProcessor::kNumberOfAffineTransformations]
|
|||||||
{k0V, k90V, k0H, k270V, k0, k90, k180, k270}
|
{k0V, k90V, k0H, k270V, k0, k90, k180, k270}
|
||||||
};
|
};
|
||||||
|
|
||||||
const rgb_color kAlphaLow = (rgb_color){ 0xbb, 0xbb, 0xbb, 0xff };
|
const rgb_color kAlphaLow = (rgb_color) { 0xbb, 0xbb, 0xbb, 0xff };
|
||||||
const rgb_color kAlphaHigh = (rgb_color){ 0xe0, 0xe0, 0xe0, 0xff };
|
const rgb_color kAlphaHigh = (rgb_color) { 0xe0, 0xe0, 0xe0, 0xff };
|
||||||
|
|
||||||
const uint32 kMsgPopUpMenuClosed = 'pmcl';
|
const uint32 kMsgPopUpMenuClosed = 'pmcl';
|
||||||
|
|
||||||
@@ -129,17 +129,16 @@ compose_checker_background(const BBitmap* bitmap)
|
|||||||
p[3] = 255;
|
p[3] = 255;
|
||||||
alpha = 255 - alpha;
|
alpha = 255 - alpha;
|
||||||
if (x % 10 >= 5) {
|
if (x % 10 >= 5) {
|
||||||
if (i % 10 >= 5) {
|
if (i % 10 >= 5)
|
||||||
blend_colors(p, kAlphaLow.red, kAlphaLow.green, kAlphaLow.blue, alpha);
|
blend_colors(p, kAlphaLow.red, kAlphaLow.green, kAlphaLow.blue, alpha);
|
||||||
} else {
|
else
|
||||||
blend_colors(p, kAlphaHigh.red, kAlphaHigh.green, kAlphaHigh.blue, alpha);
|
blend_colors(p, kAlphaHigh.red, kAlphaHigh.green, kAlphaHigh.blue, alpha);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (i % 10 >= 5) {
|
if (i % 10 >= 5)
|
||||||
blend_colors(p, kAlphaHigh.red, kAlphaHigh.green, kAlphaHigh.blue, alpha);
|
blend_colors(p, kAlphaHigh.red, kAlphaHigh.green, kAlphaHigh.blue, alpha);
|
||||||
} else {
|
else
|
||||||
blend_colors(p, kAlphaLow.red, kAlphaLow.green, kAlphaLow.blue, alpha);
|
blend_colors(p, kAlphaLow.red, kAlphaLow.green, kAlphaLow.blue, alpha);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p += 4;
|
p += 4;
|
||||||
@@ -171,7 +170,7 @@ PopUpMenu::~PopUpMenu()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
|
ShowImageView::ShowImageView(BRect rect, const char* name, uint32 resizingMode,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
:
|
:
|
||||||
BView(rect, name, resizingMode, flags),
|
BView(rect, name, resizingMode, flags),
|
||||||
@@ -249,9 +248,8 @@ ShowImageView::Pulse()
|
|||||||
BPoint mousePos;
|
BPoint mousePos;
|
||||||
uint32 buttons;
|
uint32 buttons;
|
||||||
GetMouse(&mousePos, &buttons, false);
|
GetMouse(&mousePos, &buttons, false);
|
||||||
if (Bounds().Contains(mousePos)) {
|
if (Bounds().Contains(mousePos))
|
||||||
be_app->ObscureCursor();
|
be_app->ObscureCursor();
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
fHideCursorCountDown--;
|
fHideCursorCountDown--;
|
||||||
}
|
}
|
||||||
@@ -263,7 +261,7 @@ ShowImageView::Pulse()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::_SendMessageToWindow(BMessage *message)
|
ShowImageView::_SendMessageToWindow(BMessage* message)
|
||||||
{
|
{
|
||||||
BMessenger target(Window());
|
BMessenger target(Window());
|
||||||
target.SendMessage(message);
|
target.SendMessage(message);
|
||||||
@@ -605,18 +603,18 @@ ShowImageView::_DrawBackground(BRect border)
|
|||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
// top
|
// top
|
||||||
FillRect(BRect(0, 0, bounds.right, border.top-1), B_SOLID_LOW);
|
FillRect(BRect(0, 0, bounds.right, border.top - 1), B_SOLID_LOW);
|
||||||
// left
|
// left
|
||||||
FillRect(BRect(0, border.top, border.left-1, border.bottom), B_SOLID_LOW);
|
FillRect(BRect(0, border.top, border.left - 1, border.bottom), B_SOLID_LOW);
|
||||||
// right
|
// right
|
||||||
FillRect(BRect(border.right+1, border.top, bounds.right, border.bottom), B_SOLID_LOW);
|
FillRect(BRect(border.right + 1, border.top, bounds.right, border.bottom), B_SOLID_LOW);
|
||||||
// bottom
|
// bottom
|
||||||
FillRect(BRect(0, border.bottom+1, bounds.right, bounds.bottom), B_SOLID_LOW);
|
FillRect(BRect(0, border.bottom + 1, bounds.right, bounds.bottom), B_SOLID_LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::_LayoutCaption(BFont &font, BPoint &pos, BRect &rect)
|
ShowImageView::_LayoutCaption(BFont& font, BPoint& pos, BRect& rect)
|
||||||
{
|
{
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
float width, height;
|
float width, height;
|
||||||
@@ -790,7 +788,7 @@ ShowImageView::_CopySelection(uchar alpha, bool imageSize)
|
|||||||
bool
|
bool
|
||||||
ShowImageView::_AddSupportedTypes(BMessage* msg, BBitmap* bitmap)
|
ShowImageView::_AddSupportedTypes(BMessage* msg, BBitmap* bitmap)
|
||||||
{
|
{
|
||||||
BTranslatorRoster *roster = BTranslatorRoster::Default();
|
BTranslatorRoster* roster = BTranslatorRoster::Default();
|
||||||
if (roster == NULL)
|
if (roster == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -812,9 +810,9 @@ ShowImageView::_AddSupportedTypes(BMessage* msg, BBitmap* bitmap)
|
|||||||
int32 count;
|
int32 count;
|
||||||
roster->GetOutputFormats(info[i].translator, &formats, &count);
|
roster->GetOutputFormats(info[i].translator, &formats, &count);
|
||||||
for (int32 j = 0; j < count; j++) {
|
for (int32 j = 0; j < count; j++) {
|
||||||
if (fMimeType == formats[j].MIME) {
|
if (fMimeType == formats[j].MIME)
|
||||||
foundCurrent = true;
|
foundCurrent = true;
|
||||||
} else if (strcmp(formats[j].MIME, "image/x-be-bitmap") != 0) {
|
else if (strcmp(formats[j].MIME, "image/x-be-bitmap") != 0) {
|
||||||
foundOther = true;
|
foundOther = true;
|
||||||
// needed to send data in message
|
// needed to send data in message
|
||||||
msg->AddString("be:types", formats[j].MIME);
|
msg->AddString("be:types", formats[j].MIME);
|
||||||
@@ -932,7 +930,7 @@ ShowImageView::SaveToFile(BDirectory* dir, const char* name, BBitmap* bitmap,
|
|||||||
|
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
while (loop) {
|
while (loop) {
|
||||||
BTranslatorRoster *roster = BTranslatorRoster::Default();
|
BTranslatorRoster* roster = BTranslatorRoster::Default();
|
||||||
if (!roster)
|
if (!roster)
|
||||||
break;
|
break;
|
||||||
// write data
|
// write data
|
||||||
@@ -954,7 +952,7 @@ ShowImageView::SaveToFile(BDirectory* dir, const char* name, BBitmap* bitmap,
|
|||||||
char buffer[512];
|
char buffer[512];
|
||||||
snprintf(buffer, sizeof(buffer), B_TRANSLATE("The file '%s' could not "
|
snprintf(buffer, sizeof(buffer), B_TRANSLATE("The file '%s' could not "
|
||||||
"be written."), name);
|
"be written."), name);
|
||||||
BAlert *palert = new BAlert("", buffer, B_TRANSLATE("OK"));
|
BAlert* palert = new BAlert("", buffer, B_TRANSLATE("OK"));
|
||||||
palert->Go();
|
palert->Go();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -965,14 +963,16 @@ ShowImageView::SaveToFile(BDirectory* dir, const char* name, BBitmap* bitmap,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::_SendInMessage(BMessage* msg, BBitmap* bitmap, translation_format* format)
|
ShowImageView::_SendInMessage(BMessage* msg, BBitmap* bitmap,
|
||||||
|
translation_format* format)
|
||||||
{
|
{
|
||||||
BMessage reply(B_MIME_DATA);
|
BMessage reply(B_MIME_DATA);
|
||||||
BBitmapStream stream(bitmap); // destructor deletes bitmap
|
BBitmapStream stream(bitmap); // destructor deletes bitmap
|
||||||
BTranslatorRoster *roster = BTranslatorRoster::Default();
|
BTranslatorRoster* roster = BTranslatorRoster::Default();
|
||||||
BMallocIO memStream;
|
BMallocIO memStream;
|
||||||
if (roster->Translate(&stream, NULL, NULL, &memStream, format->type) == B_OK) {
|
if (roster->Translate(&stream, NULL, NULL, &memStream, format->type) == B_OK) {
|
||||||
reply.AddData(format->MIME, B_MIME_TYPE, memStream.Buffer(), memStream.BufferLength());
|
reply.AddData(format->MIME, B_MIME_TYPE, memStream.Buffer(),
|
||||||
|
memStream.BufferLength());
|
||||||
msg->SendReply(&reply);
|
msg->SendReply(&reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1172,7 +1172,7 @@ ShowImageView::MouseMoved(BPoint point, uint32 state, const BMessage* message)
|
|||||||
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
|
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
|
||||||
if (fHideCursor) {
|
if (fHideCursor) {
|
||||||
// Show toolbar when mouse hits top 15 pixels, hide otherwise
|
// Show toolbar when mouse hits top 15 pixels, hide otherwise
|
||||||
_ShowToolBarIfEnabled(point.y <= 15);
|
_ShowToolBarIfEnabled(ConvertToScreen(point).y <= 15);
|
||||||
}
|
}
|
||||||
if (fCreatingSelection)
|
if (fCreatingSelection)
|
||||||
_UpdateSelectionRect(point, false);
|
_UpdateSelectionRect(point, false);
|
||||||
@@ -1335,7 +1335,7 @@ ShowImageView::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::_MouseWheelChanged(BMessage *msg)
|
ShowImageView::_MouseWheelChanged(BMessage* msg)
|
||||||
{
|
{
|
||||||
// The BeOS driver does not currently support
|
// The BeOS driver does not currently support
|
||||||
// X wheel scrolling, therefore, dx is zero.
|
// X wheel scrolling, therefore, dx is zero.
|
||||||
@@ -1379,14 +1379,14 @@ void
|
|||||||
ShowImageView::_ShowPopUpMenu(BPoint screen)
|
ShowImageView::_ShowPopUpMenu(BPoint screen)
|
||||||
{
|
{
|
||||||
if (!fShowingPopUpMenu) {
|
if (!fShowingPopUpMenu) {
|
||||||
PopUpMenu* menu = new PopUpMenu("PopUpMenu", this);
|
PopUpMenu* menu = new PopUpMenu("PopUpMenu", this);
|
||||||
|
|
||||||
ShowImageWindow* window = dynamic_cast<ShowImageWindow*>(Window());
|
ShowImageWindow* window = dynamic_cast<ShowImageWindow*>(Window());
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
window->BuildContextMenu(menu);
|
window->BuildContextMenu(menu);
|
||||||
|
|
||||||
menu->Go(screen, true, true, true);
|
menu->Go(screen, true, true, true);
|
||||||
fShowingPopUpMenu = true;
|
fShowingPopUpMenu = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1430,18 +1430,18 @@ ShowImageView::FixupScrollBar(orientation o, float bitmapLength,
|
|||||||
float viewLength)
|
float viewLength)
|
||||||
{
|
{
|
||||||
float prop, range;
|
float prop, range;
|
||||||
BScrollBar *psb;
|
BScrollBar* psb;
|
||||||
|
|
||||||
psb = ScrollBar(o);
|
psb = ScrollBar(o);
|
||||||
if (psb) {
|
if (psb) {
|
||||||
range = bitmapLength - viewLength;
|
range = bitmapLength - viewLength;
|
||||||
if (range < 0.0) {
|
if (range < 0.0)
|
||||||
range = 0.0;
|
range = 0.0;
|
||||||
}
|
|
||||||
prop = viewLength / bitmapLength;
|
prop = viewLength / bitmapLength;
|
||||||
if (prop > 1.0) {
|
if (prop > 1.0)
|
||||||
prop = 1.0;
|
prop = 1.0;
|
||||||
}
|
|
||||||
psb->SetRange(0, range);
|
psb->SetRange(0, range);
|
||||||
psb->SetProportion(prop);
|
psb->SetProportion(prop);
|
||||||
psb->SetSteps(10, 100);
|
psb->SetSteps(10, 100);
|
||||||
@@ -1481,22 +1481,23 @@ ShowImageView::Undo()
|
|||||||
|
|
||||||
// backup current selection
|
// backup current selection
|
||||||
BRect undoneSelRect;
|
BRect undoneSelRect;
|
||||||
BBitmap *undoneSelection;
|
BBitmap* undoneSelection;
|
||||||
undoneSelRect = fSelectionBox.Bounds();
|
undoneSelRect = fSelectionBox.Bounds();
|
||||||
undoneSelection = _CopySelection();
|
undoneSelection = _CopySelection();
|
||||||
|
|
||||||
if (undoType == UNDO_UNDO) {
|
if (undoType == UNDO_UNDO) {
|
||||||
BBitmap *undoRestore;
|
BBitmap* undoRestore;
|
||||||
undoRestore = fUndo.GetRestoreBitmap();
|
undoRestore = fUndo.GetRestoreBitmap();
|
||||||
if (undoRestore)
|
if (undoRestore)
|
||||||
_MergeWithBitmap(undoRestore, fUndo.GetRect());
|
_MergeWithBitmap(undoRestore, fUndo.GetRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore previous image/selection
|
// restore previous image/selection
|
||||||
BBitmap *undoSelection;
|
BBitmap* undoSelection;
|
||||||
undoSelection = fUndo.GetSelectionBitmap();
|
undoSelection = fUndo.GetSelectionBitmap();
|
||||||
// NOTE: ShowImageView is responsible for deleting this bitmap
|
// NOTE: ShowImageView is responsible for deleting this bitmap
|
||||||
// (Which it will, as it would with a fSelectionBitmap that it allocated itself)
|
// (Which it will, as it would with a fSelectionBitmap that it
|
||||||
|
// allocated itself)
|
||||||
if (!undoSelection)
|
if (!undoSelection)
|
||||||
_SetHasSelection(false);
|
_SetHasSelection(false);
|
||||||
else {
|
else {
|
||||||
@@ -1683,10 +1684,14 @@ ShowImageView::_DoImageOperation(ImageProcessor::operation op, bool quiet)
|
|||||||
// update orientation state
|
// update orientation state
|
||||||
if (op != ImageProcessor::kInvert) {
|
if (op != ImageProcessor::kInvert) {
|
||||||
// Note: If one of these fails, check its definition in class ImageProcessor.
|
// Note: If one of these fails, check its definition in class ImageProcessor.
|
||||||
// ASSERT(ImageProcessor::kRotateClockwise < ImageProcessor::kNumberOfAffineTransformations);
|
// ASSERT(ImageProcessor::kRotateClockwise <
|
||||||
// ASSERT(ImageProcessor::kRotateCounterClockwise < ImageProcessor::kNumberOfAffineTransformations);
|
// ImageProcessor::kNumberOfAffineTransformations);
|
||||||
// ASSERT(ImageProcessor::kFlipLeftToRight < ImageProcessor::kNumberOfAffineTransformations);
|
// ASSERT(ImageProcessor::kRotateCounterClockwise <
|
||||||
// ASSERT(ImageProcessor::kFlipTopToBottom < ImageProcessor::kNumberOfAffineTransformations);
|
// ImageProcessor::kNumberOfAffineTransformations);
|
||||||
|
// ASSERT(ImageProcessor::kFlipLeftToRight <
|
||||||
|
// ImageProcessor::kNumberOfAffineTransformations);
|
||||||
|
// ASSERT(ImageProcessor::kFlipTopToBottom <
|
||||||
|
// ImageProcessor::kNumberOfAffineTransformations);
|
||||||
fImageOrientation = fTransformation[op][fImageOrientation];
|
fImageOrientation = fTransformation[op][fImageOrientation];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1697,9 +1702,8 @@ ShowImageView::_DoImageOperation(ImageProcessor::operation op, bool quiet)
|
|||||||
if (orientation != k0) {
|
if (orientation != k0) {
|
||||||
node.WriteAttr(SHOW_IMAGE_ORIENTATION_ATTRIBUTE, B_INT32_TYPE, 0,
|
node.WriteAttr(SHOW_IMAGE_ORIENTATION_ATTRIBUTE, B_INT32_TYPE, 0,
|
||||||
&orientation, sizeof(orientation));
|
&orientation, sizeof(orientation));
|
||||||
} else {
|
} else
|
||||||
node.RemoveAttr(SHOW_IMAGE_ORIENTATION_ATTRIBUTE);
|
node.RemoveAttr(SHOW_IMAGE_ORIENTATION_ATTRIBUTE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set new bitmap
|
// set new bitmap
|
||||||
@@ -1749,7 +1753,7 @@ ShowImageView::ResizeImage(int w, int h)
|
|||||||
if (fBitmap == NULL || w < 1 || h < 1)
|
if (fBitmap == NULL || w < 1 || h < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Scaler scaler(fBitmap, BRect(0, 0, w-1, h-1), BMessenger(), 0, false);
|
Scaler scaler(fBitmap, BRect(0, 0, w - 1, h - 1), BMessenger(), 0, false);
|
||||||
scaler.Start(false);
|
scaler.Start(false);
|
||||||
BBitmap* scaled = scaler.DetachBitmap();
|
BBitmap* scaled = scaler.DetachBitmap();
|
||||||
if (scaled == NULL) {
|
if (scaled == NULL) {
|
||||||
@@ -1784,17 +1788,17 @@ ShowImageView::_SetIcon(bool clear, icon_size which)
|
|||||||
|
|
||||||
BRect rect(fBitmap->Bounds());
|
BRect rect(fBitmap->Bounds());
|
||||||
float s;
|
float s;
|
||||||
s = size / (rect.Width()+1.0);
|
s = size / (rect.Width() + 1.0);
|
||||||
|
|
||||||
if (s * (rect.Height()+1.0) <= size) {
|
if (s * (rect.Height() + 1.0) <= size) {
|
||||||
rect.right = size-1;
|
rect.right = size - 1;
|
||||||
rect.bottom = static_cast<int>(s * (rect.Height()+1.0))-1;
|
rect.bottom = static_cast<int>(s * (rect.Height() + 1.0)) - 1;
|
||||||
// center vertically
|
// center vertically
|
||||||
rect.OffsetBy(0, (size - rect.IntegerHeight()) / 2);
|
rect.OffsetBy(0, (size - rect.IntegerHeight()) / 2);
|
||||||
} else {
|
} else {
|
||||||
s = size / (rect.Height()+1.0);
|
s = size / (rect.Height() + 1.0);
|
||||||
rect.right = static_cast<int>(s * (rect.Width()+1.0))-1;
|
rect.right = static_cast<int>(s * (rect.Width() + 1.0)) - 1;
|
||||||
rect.bottom = size-1;
|
rect.bottom = size - 1;
|
||||||
// center horizontally
|
// center horizontally
|
||||||
rect.OffsetBy((size - rect.IntegerWidth()) / 2, 0);
|
rect.OffsetBy((size - rect.IntegerWidth()) / 2, 0);
|
||||||
}
|
}
|
||||||
@@ -1806,7 +1810,7 @@ ShowImageView::_SetIcon(bool clear, icon_size which)
|
|||||||
scaler.Start(false);
|
scaler.Start(false);
|
||||||
ASSERT(thumbnail->ColorSpace() == B_CMAP8);
|
ASSERT(thumbnail->ColorSpace() == B_CMAP8);
|
||||||
// create icon from thumbnail
|
// create icon from thumbnail
|
||||||
BBitmap icon(BRect(0, 0, size-1, size-1), B_CMAP8);
|
BBitmap icon(BRect(0, 0, size - 1, size - 1), B_CMAP8);
|
||||||
memset(icon.Bits(), B_TRANSPARENT_MAGIC_CMAP8, icon.BitsLength());
|
memset(icon.Bits(), B_TRANSPARENT_MAGIC_CMAP8, icon.BitsLength());
|
||||||
BScreen screen;
|
BScreen screen;
|
||||||
const uchar* src = (uchar*)thumbnail->Bits();
|
const uchar* src = (uchar*)thumbnail->Bits();
|
||||||
@@ -1816,10 +1820,10 @@ ShowImageView::_SetIcon(bool clear, icon_size which)
|
|||||||
const int32 dx = (int32)rect.left;
|
const int32 dx = (int32)rect.left;
|
||||||
const int32 dy = (int32)rect.top;
|
const int32 dy = (int32)rect.top;
|
||||||
|
|
||||||
for (int32 y = 0; y <= rect.IntegerHeight(); y ++) {
|
for (int32 y = 0; y <= rect.IntegerHeight(); y++) {
|
||||||
for (int32 x = 0; x <= rect.IntegerWidth(); x ++) {
|
for (int32 x = 0; x <= rect.IntegerWidth(); x++) {
|
||||||
const uchar* s = src + y * srcBPR + x;
|
const uchar* s = src + y * srcBPR + x;
|
||||||
uchar* d = dest + (y+dy) * destBPR + (x+dx);
|
uchar* d = dest + (y + dy) * destBPR + (x + dx);
|
||||||
*d = *s;
|
*d = *s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,20 +104,20 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
enum image_orientation {
|
enum image_orientation {
|
||||||
k0, // 0
|
k0, // 0
|
||||||
k90, // 1
|
k90, // 1
|
||||||
k180, // 2
|
k180, // 2
|
||||||
k270, // 3
|
k270, // 3
|
||||||
k0V, // 4
|
k0V, // 4
|
||||||
k90V, // 5
|
k90V, // 5
|
||||||
k0H, // 6
|
k0H, // 6
|
||||||
k270V, // 7
|
k270V, // 7
|
||||||
kNumberOfOrientations,
|
kNumberOfOrientations,
|
||||||
};
|
};
|
||||||
|
|
||||||
void _SetHasSelection(bool bHasSelection);
|
void _SetHasSelection(bool bHasSelection);
|
||||||
void _AnimateSelection(bool a);
|
void _AnimateSelection(bool a);
|
||||||
void _SendMessageToWindow(BMessage *message);
|
void _SendMessageToWindow(BMessage* message);
|
||||||
void _SendMessageToWindow(uint32 code);
|
void _SendMessageToWindow(uint32 code);
|
||||||
void _Notify();
|
void _Notify();
|
||||||
void _UpdateStatusText();
|
void _UpdateStatusText();
|
||||||
|
|||||||
@@ -990,7 +990,8 @@ ShowImageWindow::MessageReceived(BMessage* message)
|
|||||||
backgroundsMessage.AddRef("refs", fImageView->Image());
|
backgroundsMessage.AddRef("refs", fImageView->Image());
|
||||||
// This is used in the Backgrounds code for scaled placement
|
// This is used in the Backgrounds code for scaled placement
|
||||||
backgroundsMessage.AddInt32("placement", 'scpl');
|
backgroundsMessage.AddInt32("placement", 'scpl');
|
||||||
be_roster->Launch("application/x-vnd.haiku-backgrounds", &backgroundsMessage);
|
be_roster->Launch("application/x-vnd.haiku-backgrounds",
|
||||||
|
&backgroundsMessage);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,15 +1051,15 @@ ShowImageWindow::MessageReceived(BMessage* message)
|
|||||||
if (message->FindFloat("offset", &offset) == B_OK
|
if (message->FindFloat("offset", &offset) == B_OK
|
||||||
&& message->FindBool("show", &show) == B_OK) {
|
&& message->FindBool("show", &show) == B_OK) {
|
||||||
// Compensate rounding errors with the final placement
|
// Compensate rounding errors with the final placement
|
||||||
if (show) {
|
if (show)
|
||||||
fToolBarView->MoveTo(fToolBarView->Frame().left, 0);
|
fToolBarView->MoveTo(fToolBarView->Frame().left, 0);
|
||||||
} else {
|
else {
|
||||||
fToolBarView->MoveTo(fToolBarView->Frame().left, offset);
|
fToolBarView->MoveTo(fToolBarView->Frame().left, offset);
|
||||||
fToolBarView->Hide();
|
fToolBarView->Hide();
|
||||||
}
|
}
|
||||||
BRect frame = fToolBarView->Parent()->Bounds();
|
BRect frame = fToolBarView->Parent()->Bounds();
|
||||||
frame.top = fToolBarView->Frame().bottom + 1;
|
frame.top = fToolBarView->Frame().bottom + 1;
|
||||||
fScrollView->MoveTo(0, frame.top);
|
fScrollView->MoveTo(fScrollView->Frame().left, frame.top);
|
||||||
fScrollView->ResizeTo(fScrollView->Bounds().Width(),
|
fScrollView->ResizeTo(fScrollView->Bounds().Width(),
|
||||||
frame.Height() - B_H_SCROLL_BAR_HEIGHT + 1);
|
frame.Height() - B_H_SCROLL_BAR_HEIGHT + 1);
|
||||||
fVerticalScrollBar->MoveTo(
|
fVerticalScrollBar->MoveTo(
|
||||||
@@ -1174,7 +1175,8 @@ ShowImageWindow::_SaveToFile(BMessage* message)
|
|||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0; i < outCount; i++) {
|
for (i = 0; i < outCount; i++) {
|
||||||
if (outFormat[i].group == B_TRANSLATOR_BITMAP && outFormat[i].type == outType)
|
if (outFormat[i].group == B_TRANSLATOR_BITMAP && outFormat[i].type
|
||||||
|
== outType)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == outCount)
|
if (i == outCount)
|
||||||
@@ -1271,7 +1273,7 @@ ShowImageWindow::_ToggleFullScreen()
|
|||||||
BScreen screen;
|
BScreen screen;
|
||||||
fWindowFrame = Frame();
|
fWindowFrame = Frame();
|
||||||
frame = screen.Frame();
|
frame = screen.Frame();
|
||||||
frame.top -= fBar->Bounds().Height()+1;
|
frame.top -= fBar->Bounds().Height() + 1;
|
||||||
frame.right += B_V_SCROLL_BAR_WIDTH;
|
frame.right += B_V_SCROLL_BAR_WIDTH;
|
||||||
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
|
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
|
||||||
frame.InsetBy(-1, -1); // PEN_SIZE in ShowImageView
|
frame.InsetBy(-1, -1); // PEN_SIZE in ShowImageView
|
||||||
@@ -1414,7 +1416,7 @@ ShowImageWindow::_Print(BMessage* msg)
|
|||||||
float width;
|
float width;
|
||||||
switch (fPrintOptions.Option()) {
|
switch (fPrintOptions.Option()) {
|
||||||
case PrintOptions::kFitToPage: {
|
case PrintOptions::kFitToPage: {
|
||||||
float w1 = printableRect.Width()+1;
|
float w1 = printableRect.Width() + 1;
|
||||||
float w2 = imageWidth * (printableRect.Height() + 1)
|
float w2 = imageWidth * (printableRect.Height() + 1)
|
||||||
/ imageHeight;
|
/ imageHeight;
|
||||||
if (w2 < w1)
|
if (w2 < w1)
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ ToolBarView::AddAction(uint32 command, BHandler* target, const BBitmap* icon,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ToolBarView::AddAction(BMessage* message, BHandler* target, const BBitmap* icon,
|
ToolBarView::AddAction(BMessage* message, BHandler* target,
|
||||||
const char* toolTipText)
|
const BBitmap* icon, const char* toolTipText)
|
||||||
{
|
{
|
||||||
BIconButton* button = new BIconButton(NULL, NULL, message, target);
|
BIconButton* button = new BIconButton(NULL, NULL, message, target);
|
||||||
button->SetIcon(icon);
|
button->SetIcon(icon);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
// default window positioning
|
// default window positioning
|
||||||
static const float MIN_WIDTH = 400.0f;
|
static const float MIN_WIDTH = 400.0f;
|
||||||
static const float MIN_HEIGHT = 336.0f;
|
static const float MIN_HEIGHT = 175.0f;
|
||||||
static const float XPOS = 100.0f;
|
static const float XPOS = 100.0f;
|
||||||
static const float YPOS = 200.0f;
|
static const float YPOS = 200.0f;
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ RecorderWindow::InitWindow()
|
|||||||
fSoundList = new SoundListView(r, B_TRANSLATE("Sound List"),
|
fSoundList = new SoundListView(r, B_TRANSLATE("Sound List"),
|
||||||
B_FOLLOW_ALL);
|
B_FOLLOW_ALL);
|
||||||
fSoundList->SetSelectionMessage(new BMessage(SOUND_SELECTED));
|
fSoundList->SetSelectionMessage(new BMessage(SOUND_SELECTED));
|
||||||
fSoundList->SetViewColor(216, 216, 216);
|
fSoundList->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
BScrollView *scroller = new BScrollView("scroller", fSoundList,
|
BScrollView *scroller = new BScrollView("scroller", fSoundList,
|
||||||
B_FOLLOW_ALL, 0, false, true, B_FANCY_BORDER);
|
B_FOLLOW_ALL, 0, false, true, B_FANCY_BORDER);
|
||||||
fBottomBox->AddChild(scroller);
|
fBottomBox->AddChild(scroller);
|
||||||
@@ -374,43 +374,75 @@ RecorderWindow::InitWindow()
|
|||||||
r.bottom -= 25;
|
r.bottom -= 25;
|
||||||
r.InsetBy(10, 8);
|
r.InsetBy(10, 8);
|
||||||
r.top -= 1;
|
r.top -= 1;
|
||||||
fFileInfoBox = new BBox(r, "fileinfo", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
fFileInfoBox = new BBox(r, "fileinfo", B_FOLLOW_LEFT);
|
||||||
fFileInfoBox->SetLabel(B_TRANSLATE("File info"));
|
fFileInfoBox->SetLabel(B_TRANSLATE("File info"));
|
||||||
|
|
||||||
|
fFileInfoBox->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
BFont font = be_plain_font;
|
||||||
|
font.SetSize(font.Size() * 0.92f);
|
||||||
|
font_height height;
|
||||||
|
font.GetHeight(&height);
|
||||||
|
float fontHeight = height.ascent + height.leading + height.descent;
|
||||||
|
|
||||||
r = fFileInfoBox->Bounds();
|
r = fFileInfoBox->Bounds();
|
||||||
r.left = 8;
|
r.left = 8;
|
||||||
r.top = 13;
|
r.top = fontHeight + 6;
|
||||||
r.bottom = r.top + 15;
|
r.bottom = r.top + fontHeight + 3;
|
||||||
r.right -= 10;
|
r.right -= 10;
|
||||||
fFilename = new BStringView(r, "filename", B_TRANSLATE("File name:"));
|
fFilename = new BStringView(r, "filename", B_TRANSLATE("File name:"));
|
||||||
fFileInfoBox->AddChild(fFilename);
|
fFileInfoBox->AddChild(fFilename);
|
||||||
r.top += 13;
|
fFilename->SetFont(&font, B_FONT_SIZE);
|
||||||
r.bottom = r.top + 15;
|
fFilename->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
r.top += fontHeight;
|
||||||
|
r.bottom = r.top + fontHeight + 3;
|
||||||
fFormat = new BStringView(r, "format", B_TRANSLATE("Format:"));
|
fFormat = new BStringView(r, "format", B_TRANSLATE("Format:"));
|
||||||
fFileInfoBox->AddChild(fFormat);
|
fFileInfoBox->AddChild(fFormat);
|
||||||
r.top += 13;
|
fFormat->SetFont(&font, B_FONT_SIZE);
|
||||||
r.bottom = r.top + 15;
|
fFormat->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
r.top += fontHeight;
|
||||||
|
r.bottom = r.top + fontHeight + 3;
|
||||||
fCompression = new BStringView(r, "compression",
|
fCompression = new BStringView(r, "compression",
|
||||||
B_TRANSLATE("Compression:"));
|
B_TRANSLATE("Compression:"));
|
||||||
fFileInfoBox->AddChild(fCompression);
|
fFileInfoBox->AddChild(fCompression);
|
||||||
r.top += 13;
|
fCompression->SetFont(&font, B_FONT_SIZE);
|
||||||
r.bottom = r.top + 15;
|
fCompression->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
r.top += fontHeight;
|
||||||
|
r.bottom = r.top + fontHeight + 3;
|
||||||
fChannels = new BStringView(r, "channels", B_TRANSLATE("Channels:"));
|
fChannels = new BStringView(r, "channels", B_TRANSLATE("Channels:"));
|
||||||
fFileInfoBox->AddChild(fChannels);
|
fFileInfoBox->AddChild(fChannels);
|
||||||
r.top += 13;
|
fChannels->SetFont(&font, B_FONT_SIZE);
|
||||||
r.bottom = r.top + 15;
|
fChannels->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
r.top += fontHeight;
|
||||||
|
r.bottom = r.top + fontHeight + 3;
|
||||||
fSampleSize = new BStringView(r, "samplesize",
|
fSampleSize = new BStringView(r, "samplesize",
|
||||||
B_TRANSLATE("Sample size:"));
|
B_TRANSLATE("Sample size:"));
|
||||||
fFileInfoBox->AddChild(fSampleSize);
|
fFileInfoBox->AddChild(fSampleSize);
|
||||||
r.top += 13;
|
fSampleSize->SetFont(&font, B_FONT_SIZE);
|
||||||
r.bottom = r.top + 15;
|
fSampleSize->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
r.top += fontHeight;
|
||||||
|
r.bottom = r.top + fontHeight + 3;
|
||||||
fSampleRate = new BStringView(r, "samplerate",
|
fSampleRate = new BStringView(r, "samplerate",
|
||||||
B_TRANSLATE("Sample rate:"));
|
B_TRANSLATE("Sample rate:"));
|
||||||
fFileInfoBox->AddChild(fSampleRate);
|
fFileInfoBox->AddChild(fSampleRate);
|
||||||
r.top += 13;
|
fSampleRate->SetFont(&font, B_FONT_SIZE);
|
||||||
r.bottom = r.top + 15;
|
fSampleRate->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
r.top += fontHeight;
|
||||||
|
r.bottom = r.top + fontHeight + 3;
|
||||||
fDuration = new BStringView(r, "duration", B_TRANSLATE("Duration:"));
|
fDuration = new BStringView(r, "duration", B_TRANSLATE("Duration:"));
|
||||||
fFileInfoBox->AddChild(fDuration);
|
fFileInfoBox->AddChild(fDuration);
|
||||||
|
fDuration->SetFont(&font, B_FONT_SIZE);
|
||||||
|
fDuration->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
|
|
||||||
|
fFileInfoBox->ResizeTo(fFileInfoBox->Frame().Width(),
|
||||||
|
r.bottom + fontHeight / 2.0f);
|
||||||
|
fDeployedHeight = MIN_HEIGHT + fFileInfoBox->Bounds().Height() + 40.0f;
|
||||||
|
|
||||||
// Input selection lists all available physical inputs that produce
|
// Input selection lists all available physical inputs that produce
|
||||||
// buffers with B_MEDIA_RAW_AUDIO format data.
|
// buffers with B_MEDIA_RAW_AUDIO format data.
|
||||||
@@ -451,12 +483,10 @@ RecorderWindow::InitWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the actual widget
|
// Create the actual widget
|
||||||
BRect frame(fBottomBox->Bounds());
|
r = fFileInfoBox->Bounds();
|
||||||
r = frame;
|
r.top = r.bottom + 2;
|
||||||
r.left = 42;
|
r.bottom = r.top + 18;
|
||||||
r.right = (r.left + r.right) / 2;
|
r.InsetBy(10, 10);
|
||||||
r.InsetBy(10,10);
|
|
||||||
r.top = r.bottom - 18;
|
|
||||||
fInputField = new BMenuField(r, "Input", B_TRANSLATE("Input:"), popup);
|
fInputField = new BMenuField(r, "Input", B_TRANSLATE("Input:"), popup);
|
||||||
fInputField->SetDivider(fInputField->StringWidth(B_TRANSLATE("Input:"))
|
fInputField->SetDivider(fInputField->StringWidth(B_TRANSLATE("Input:"))
|
||||||
+ 4.0f);
|
+ 4.0f);
|
||||||
@@ -465,9 +495,8 @@ RecorderWindow::InitWindow()
|
|||||||
fBottomBox->AddChild(fFileInfoBox);
|
fBottomBox->AddChild(fFileInfoBox);
|
||||||
|
|
||||||
fBottomBox->Hide();
|
fBottomBox->Hide();
|
||||||
CalcSizes(Frame().Width(), MIN_HEIGHT-161);
|
CalcSizes(MIN_WIDTH, MIN_HEIGHT);
|
||||||
ResizeTo(Frame().Width(), MIN_HEIGHT-161);
|
ResizeTo(Frame().Width(), MIN_HEIGHT);
|
||||||
|
|
||||||
|
|
||||||
popup->Superitem()->SetLabel(selected_name);
|
popup->Superitem()->SetLabel(selected_name);
|
||||||
|
|
||||||
@@ -551,12 +580,12 @@ RecorderWindow::MessageReceived(BMessage * message)
|
|||||||
case VIEW_LIST:
|
case VIEW_LIST:
|
||||||
if (fUpDownButton->Value() == B_CONTROL_ON) {
|
if (fUpDownButton->Value() == B_CONTROL_ON) {
|
||||||
fBottomBox->Show();
|
fBottomBox->Show();
|
||||||
CalcSizes(Frame().Width(), MIN_HEIGHT);
|
CalcSizes(MIN_WIDTH, fDeployedHeight);
|
||||||
ResizeTo(Frame().Width(), MIN_HEIGHT);
|
ResizeTo(Frame().Width(), fDeployedHeight);
|
||||||
} else {
|
} else {
|
||||||
fBottomBox->Hide();
|
fBottomBox->Hide();
|
||||||
CalcSizes(Frame().Width(), MIN_HEIGHT-161);
|
CalcSizes(MIN_WIDTH, MIN_HEIGHT);
|
||||||
ResizeTo(Frame().Width(), MIN_HEIGHT-161);
|
ResizeTo(Frame().Width(), MIN_HEIGHT);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ private:
|
|||||||
BDirectory fTempDir;
|
BDirectory fTempDir;
|
||||||
int fTempCount;
|
int fTempCount;
|
||||||
|
|
||||||
|
float fDeployedHeight;
|
||||||
|
|
||||||
BBox * fBottomBox;
|
BBox * fBottomBox;
|
||||||
BBox * fFileInfoBox;
|
BBox * fFileInfoBox;
|
||||||
BStringView *fFilename;
|
BStringView *fFilename;
|
||||||
|
|||||||
@@ -34,12 +34,11 @@ void
|
|||||||
SoundListView::Draw(BRect updateRect)
|
SoundListView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
if (IsEmpty()) {
|
if (IsEmpty()) {
|
||||||
SetHighColor(235,235,235);
|
SetLowColor(ViewColor());
|
||||||
FillRect(Bounds());
|
FillRect(Bounds(), B_SOLID_LOW);
|
||||||
|
|
||||||
SetHighColor(0,0,0);
|
SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
||||||
BFont font(be_bold_font);
|
BFont font(be_bold_font);
|
||||||
font.SetSize(12.0);
|
|
||||||
SetFont(&font);
|
SetFont(&font);
|
||||||
font_height height;
|
font_height height;
|
||||||
font.GetHeight(&height);
|
font.GetHeight(&height);
|
||||||
@@ -58,7 +57,8 @@ void
|
|||||||
SoundListView::AttachedToWindow()
|
SoundListView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BListView::AttachedToWindow();
|
BListView::AttachedToWindow();
|
||||||
SetViewColor(255,255,255);
|
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
|
B_LIGHTEN_1_TINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -642,6 +642,22 @@ BScrollBar::MessageReceived(BMessage* message)
|
|||||||
ValueChanged(value);
|
ValueChanged(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case B_MOUSE_WHEEL_CHANGED:
|
||||||
|
{
|
||||||
|
// Must handle this here since BView checks for the existence of
|
||||||
|
// scrollbars, which a scrollbar itself does not have
|
||||||
|
float deltaX = 0.0f, deltaY = 0.0f;
|
||||||
|
message->FindFloat("be:wheel_delta_x", &deltaX);
|
||||||
|
message->FindFloat("be:wheel_delta_y", &deltaY);
|
||||||
|
|
||||||
|
if (deltaX == 0.0f && deltaY == 0.0f)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (deltaX != 0.0f && deltaY == 0.0f)
|
||||||
|
deltaY = deltaX;
|
||||||
|
|
||||||
|
ScrollWithMouseWheelDelta(this, deltaY);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
|
|||||||
+22
-21
@@ -4350,31 +4350,12 @@ BView::MessageReceived(BMessage* msg)
|
|||||||
if (deltaX == 0.0f && deltaY == 0.0f)
|
if (deltaX == 0.0f && deltaY == 0.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
float smallStep, largeStep;
|
|
||||||
if (horizontal != NULL) {
|
if (horizontal != NULL) {
|
||||||
horizontal->GetSteps(&smallStep, &largeStep);
|
ScrollWithMouseWheelDelta(horizontal, deltaX);
|
||||||
|
|
||||||
// pressing the option/command/control key scrolls faster
|
|
||||||
if (modifiers()
|
|
||||||
& (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) {
|
|
||||||
deltaX *= largeStep;
|
|
||||||
} else
|
|
||||||
deltaX *= smallStep * 3;
|
|
||||||
|
|
||||||
horizontal->SetValue(horizontal->Value() + deltaX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertical != NULL) {
|
if (vertical != NULL) {
|
||||||
vertical->GetSteps(&smallStep, &largeStep);
|
ScrollWithMouseWheelDelta(vertical, deltaY);
|
||||||
|
|
||||||
// pressing the option/command/control key scrolls faster
|
|
||||||
if (modifiers()
|
|
||||||
& (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) {
|
|
||||||
deltaY *= largeStep;
|
|
||||||
} else
|
|
||||||
deltaY *= smallStep * 3;
|
|
||||||
|
|
||||||
vertical->SetValue(vertical->Value() + deltaY);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -5721,6 +5702,26 @@ BView::_SwitchServerCurrentView() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::ScrollWithMouseWheelDelta(BScrollBar* scrollBar, float delta)
|
||||||
|
{
|
||||||
|
if (scrollBar == NULL || delta == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float smallStep, largeStep;
|
||||||
|
scrollBar->GetSteps(&smallStep, &largeStep);
|
||||||
|
|
||||||
|
// pressing the option/command/control key scrolls faster
|
||||||
|
if (modifiers()
|
||||||
|
& (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) {
|
||||||
|
delta *= largeStep;
|
||||||
|
} else
|
||||||
|
delta *= smallStep * 3;
|
||||||
|
|
||||||
|
scrollBar->SetValue(scrollBar->Value() + delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if __GNUC__ == 2
|
#if __GNUC__ == 2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ StaticLibrary libshared.a :
|
|||||||
RWLockManager.cpp
|
RWLockManager.cpp
|
||||||
SHA256.cpp
|
SHA256.cpp
|
||||||
ShakeTrackingFilter.cpp
|
ShakeTrackingFilter.cpp
|
||||||
|
StringForRate.cpp
|
||||||
StringForSize.cpp
|
StringForSize.cpp
|
||||||
Variant.cpp
|
Variant.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StringForRate.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <SystemCatalog.h>
|
||||||
|
|
||||||
|
using BPrivate::gSystemCatalog;
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATION_CONTEXT
|
||||||
|
#define B_TRANSLATION_CONTEXT "StringForRate"
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
string_for_rate(double rate, char* string, size_t stringSize, double base)
|
||||||
|
{
|
||||||
|
double kbps = rate / base;
|
||||||
|
if (kbps < 1.0) {
|
||||||
|
const char* trKey = B_TRANSLATE_MARK("%.0f bps");
|
||||||
|
snprintf(string, stringSize, gSystemCatalog.GetString(trKey,
|
||||||
|
B_TRANSLATION_CONTEXT), (int)rate);
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
double mbps = kbps / base;
|
||||||
|
if (mbps < 1.0) {
|
||||||
|
const char* trKey = B_TRANSLATE_MARK("%.0f kbps");
|
||||||
|
snprintf(string, stringSize, gSystemCatalog.GetString(trKey,
|
||||||
|
B_TRANSLATION_CONTEXT), kbps);
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
double gbps = mbps / base;
|
||||||
|
if (gbps < 1.0) {
|
||||||
|
const char* trKey = B_TRANSLATE_MARK("%.0f mbps");
|
||||||
|
snprintf(string, stringSize, gSystemCatalog.GetString(trKey,
|
||||||
|
B_TRANSLATION_CONTEXT), mbps);
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
double tbps = gbps / base;
|
||||||
|
if (tbps < 1.0) {
|
||||||
|
const char* trKey = B_TRANSLATE_MARK("%.0f gbps");
|
||||||
|
snprintf(string, stringSize, gSystemCatalog.GetString(trKey,
|
||||||
|
B_TRANSLATION_CONTEXT), gbps);
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
const char* trKey = B_TRANSLATE_MARK("%.0f tbps");
|
||||||
|
snprintf(string, stringSize, gSystemCatalog.GetString(trKey,
|
||||||
|
B_TRANSLATION_CONTEXT), tbps);
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool fPrintStackTrace;
|
bool fPrintStackTrace;
|
||||||
page_num_t fPageFilter;
|
page_num_t fPageFilter;
|
||||||
team_id fTeamFilter;
|
team_id fTeamFilter;
|
||||||
thread_id fThreadFilter;
|
thread_id fThreadFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1530,7 +1530,7 @@ free_page(vm_page* page, bool clear)
|
|||||||
TA(FreePage(page->physical_page_number));
|
TA(FreePage(page->physical_page_number));
|
||||||
|
|
||||||
#if VM_PAGE_ALLOCATION_TRACKING_AVAILABLE
|
#if VM_PAGE_ALLOCATION_TRACKING_AVAILABLE
|
||||||
page->allocation_tracking_info.Clear();
|
page->allocation_tracking_info.Clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReadLocker locker(sFreePageQueuesLock);
|
ReadLocker locker(sFreePageQueuesLock);
|
||||||
@@ -2295,12 +2295,12 @@ status_t
|
|||||||
page_writer(void* /*unused*/)
|
page_writer(void* /*unused*/)
|
||||||
{
|
{
|
||||||
const uint32 kNumPages = 256;
|
const uint32 kNumPages = 256;
|
||||||
uint32 writtenPages = 0;
|
|
||||||
#ifdef TRACE_VM_PAGE
|
#ifdef TRACE_VM_PAGE
|
||||||
|
uint32 writtenPages = 0;
|
||||||
bigtime_t lastWrittenTime = 0;
|
bigtime_t lastWrittenTime = 0;
|
||||||
#endif
|
|
||||||
bigtime_t pageCollectionTime = 0;
|
bigtime_t pageCollectionTime = 0;
|
||||||
bigtime_t pageWritingTime = 0;
|
bigtime_t pageWritingTime = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
PageWriterRun run;
|
PageWriterRun run;
|
||||||
if (run.Init(kNumPages) != B_OK) {
|
if (run.Init(kNumPages) != B_OK) {
|
||||||
@@ -2356,7 +2356,9 @@ page_writer(void* /*unused*/)
|
|||||||
// enough to do).
|
// enough to do).
|
||||||
|
|
||||||
// collect pages to be written
|
// collect pages to be written
|
||||||
|
#ifdef TRACE_VM_PAGE
|
||||||
pageCollectionTime -= system_time();
|
pageCollectionTime -= system_time();
|
||||||
|
#endif
|
||||||
|
|
||||||
page_num_t maxPagesToSee = modifiedPages;
|
page_num_t maxPagesToSee = modifiedPages;
|
||||||
|
|
||||||
@@ -2429,31 +2431,35 @@ page_writer(void* /*unused*/)
|
|||||||
numPages++;
|
numPages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TRACE_VM_PAGE
|
||||||
pageCollectionTime += system_time();
|
pageCollectionTime += system_time();
|
||||||
|
#endif
|
||||||
if (numPages == 0)
|
if (numPages == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// write pages to disk and do all the cleanup
|
// write pages to disk and do all the cleanup
|
||||||
|
#ifdef TRACE_VM_PAGE
|
||||||
pageWritingTime -= system_time();
|
pageWritingTime -= system_time();
|
||||||
|
#endif
|
||||||
uint32 failedPages = run.Go();
|
uint32 failedPages = run.Go();
|
||||||
|
#ifdef TRACE_VM_PAGE
|
||||||
pageWritingTime += system_time();
|
pageWritingTime += system_time();
|
||||||
|
|
||||||
// debug output only...
|
// debug output only...
|
||||||
writtenPages += numPages;
|
writtenPages += numPages;
|
||||||
if (writtenPages >= 1024) {
|
if (writtenPages >= 1024) {
|
||||||
#ifdef TRACE_VM_PAGE
|
|
||||||
bigtime_t now = system_time();
|
bigtime_t now = system_time();
|
||||||
TRACE(("page writer: wrote 1024 pages (total: %llu ms, "
|
TRACE(("page writer: wrote 1024 pages (total: %llu ms, "
|
||||||
"collect: %llu ms, write: %llu ms)\n",
|
"collect: %llu ms, write: %llu ms)\n",
|
||||||
(now - lastWrittenTime) / 1000,
|
(now - lastWrittenTime) / 1000,
|
||||||
pageCollectionTime / 1000, pageWritingTime / 1000));
|
pageCollectionTime / 1000, pageWritingTime / 1000));
|
||||||
lastWrittenTime = now;
|
lastWrittenTime = now;
|
||||||
#endif
|
|
||||||
writtenPages -= 1024;
|
writtenPages -= 1024;
|
||||||
pageCollectionTime = 0;
|
pageCollectionTime = 0;
|
||||||
pageWritingTime = 0;
|
pageWritingTime = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (failedPages == numPages)
|
if (failedPages == numPages)
|
||||||
pagesSinceLastSuccessfulWrite += modifiedPages - maxPagesToSee;
|
pagesSinceLastSuccessfulWrite += modifiedPages - maxPagesToSee;
|
||||||
|
|||||||
Reference in New Issue
Block a user