Fixed version number format and calculations
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5988 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -44,12 +44,15 @@
|
|||||||
#define B_CMYK32 ((color_space)0xC003) /* C[7:0] M[7:0] Y[7:0] K[7:0] */
|
#define B_CMYK32 ((color_space)0xC003) /* C[7:0] M[7:0] Y[7:0] K[7:0] */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PPM_TRANSLATOR_VERSION 100
|
#define PPM_TRANSLATOR_VERSION 0x100
|
||||||
|
|
||||||
/* These three data items are exported by every translator. */
|
/* These three data items are exported by every translator. */
|
||||||
char translatorName[] = "PPM Images";
|
char translatorName[] = "PPM Images";
|
||||||
char translatorInfo[] = "PPM image translator v1.0.0, " __DATE__;
|
char translatorInfo[] = "PPM image translator v1.0.0, " __DATE__;
|
||||||
int32 translatorVersion = PPM_TRANSLATOR_VERSION; /* format is revision+minor*10+major*100 */
|
int32 translatorVersion = PPM_TRANSLATOR_VERSION;
|
||||||
|
// Revision: lowest 4 bits
|
||||||
|
// Minor: next 4 bits
|
||||||
|
// Major: highest 24 bits
|
||||||
|
|
||||||
/* Be reserves all codes with non-lowecase letters in them. */
|
/* Be reserves all codes with non-lowecase letters in them. */
|
||||||
/* Luckily, there is already a reserved code for PPM. If you */
|
/* Luckily, there is already a reserved code for PPM. If you */
|
||||||
@@ -195,7 +198,10 @@ public:
|
|||||||
path.Append("PPMTranslator_Settings");
|
path.Append("PPMTranslator_Settings");
|
||||||
FILE * f = fopen(path.Path(), "w");
|
FILE * f = fopen(path.Path(), "w");
|
||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "# PPMTranslator settings version %.2f\n", (float)translatorVersion/100.0);
|
fprintf(f, "# PPMTranslator settings version %d.%d.%d\n",
|
||||||
|
static_cast<int>(translatorVersion >> 8),
|
||||||
|
static_cast<int>((translatorVersion >> 4) & 0xf),
|
||||||
|
static_cast<int>(translatorVersion & 0xf));
|
||||||
fprintf(f, "color_space = %d\n", g_settings.out_space);
|
fprintf(f, "color_space = %d\n", g_settings.out_space);
|
||||||
fprintf(f, "window_pos = %g,%g\n", g_settings.window_pos.x, g_settings.window_pos.y);
|
fprintf(f, "window_pos = %g,%g\n", g_settings.window_pos.x, g_settings.window_pos.y);
|
||||||
fprintf(f, "write_ascii = %d\n", g_settings.write_ascii ? 1 : 0);
|
fprintf(f, "write_ascii = %d\n", g_settings.write_ascii ? 1 : 0);
|
||||||
@@ -494,8 +500,8 @@ virtual void Draw(
|
|||||||
|
|
||||||
char detail[100];
|
char detail[100];
|
||||||
int ver = static_cast<int>(translatorVersion);
|
int ver = static_cast<int>(translatorVersion);
|
||||||
sprintf(detail, "Version %d.%d.%d %s", ver / 100, (ver / 10) % 10,
|
sprintf(detail, "Version %d.%d.%d %s", ver >> 8, ((ver >> 4) & 0xf),
|
||||||
ver % 10, __DATE__);
|
(ver & 0xf), __DATE__);
|
||||||
DrawString(detail, BPoint(xbold, yplain + ybold));
|
DrawString(detail, BPoint(xbold, yplain + ybold));
|
||||||
|
|
||||||
DrawString("Based on PPMTranslator sample code",
|
DrawString("Based on PPMTranslator sample code",
|
||||||
|
|||||||
Reference in New Issue
Block a user