More indentation!
See https://sourceforge.net/p/tuxpaint/mailman/message/36077409/
This commit is contained in:
parent
cb8c885433
commit
a4d213178d
4 changed files with 1804 additions and 1797 deletions
1
osk/.indent.pro
vendored
Symbolic link
1
osk/.indent.pro
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../src/.indent.pro
|
||||||
3410
osk/keysymdef.h
3410
osk/keysymdef.h
File diff suppressed because it is too large
Load diff
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Jan. 17, 2003 */
|
/* Jan. 17, 2003 */
|
||||||
|
|
||||||
#include "BeOS_print.h"
|
#include "BeOS_print.h"
|
||||||
|
|
@ -36,117 +36,122 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
|
|
||||||
class PrintView : public BView
|
class PrintView:public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrintView( BBitmap *bitmap)
|
PrintView(BBitmap * bitmap):BView(bitmap->Bounds(), "TuxPaint Print", B_FOLLOW_NONE, B_WILL_DRAW)
|
||||||
: BView( bitmap->Bounds(), "TuxPaint Print", B_FOLLOW_NONE, B_WILL_DRAW)
|
{
|
||||||
{
|
b = bitmap;
|
||||||
b = bitmap;
|
};
|
||||||
};
|
|
||||||
~PrintView()
|
~PrintView()
|
||||||
{
|
{
|
||||||
delete b;
|
delete b;
|
||||||
};
|
};
|
||||||
void Draw( BRect updateRect)
|
void Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
DrawBitmap( b);
|
DrawBitmap(b);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
BBitmap *b;
|
BBitmap * b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BBitmap *SurfaceToBBitmap( SDL_Surface *surf)
|
BBitmap *SurfaceToBBitmap(SDL_Surface * surf)
|
||||||
{
|
{
|
||||||
BBitmap *bitmap = new BBitmap( BRect( 0, 0, surf->w, surf->h), B_RGBA32);
|
BBitmap *bitmap = new BBitmap(BRect(0, 0, surf->w, surf->h), B_RGBA32);
|
||||||
SDL_PixelFormat pixfmt;
|
SDL_PixelFormat pixfmt;
|
||||||
SDL_Surface *surf32;
|
SDL_Surface *surf32;
|
||||||
Uint8 *src,*dst;
|
Uint8 *src, *dst;
|
||||||
Uint32 linesize;
|
Uint32 linesize;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset( &pixfmt, 0, sizeof(pixfmt) );
|
memset(&pixfmt, 0, sizeof(pixfmt));
|
||||||
pixfmt.palette = NULL;
|
pixfmt.palette = NULL;
|
||||||
pixfmt.BitsPerPixel = 32;
|
pixfmt.BitsPerPixel = 32;
|
||||||
pixfmt.BytesPerPixel= 4;
|
pixfmt.BytesPerPixel = 4;
|
||||||
pixfmt.Rmask = 0x00FF0000;
|
pixfmt.Rmask = 0x00FF0000;
|
||||||
pixfmt.Gmask = 0x0000FF00;
|
pixfmt.Gmask = 0x0000FF00;
|
||||||
pixfmt.Bmask = 0x000000FF;
|
pixfmt.Bmask = 0x000000FF;
|
||||||
pixfmt.Amask = 0xFF000000;
|
pixfmt.Amask = 0xFF000000;
|
||||||
pixfmt.Rshift = 16;
|
pixfmt.Rshift = 16;
|
||||||
pixfmt.Gshift = 8;
|
pixfmt.Gshift = 8;
|
||||||
pixfmt.Bshift = 0;
|
pixfmt.Bshift = 0;
|
||||||
pixfmt.Ashift = 24;
|
pixfmt.Ashift = 24;
|
||||||
pixfmt.Rloss = 0;
|
pixfmt.Rloss = 0;
|
||||||
pixfmt.Gloss = 0;
|
pixfmt.Gloss = 0;
|
||||||
pixfmt.Bloss = 0;
|
pixfmt.Bloss = 0;
|
||||||
pixfmt.Aloss = 0;
|
pixfmt.Aloss = 0;
|
||||||
pixfmt.colorkey = 0;
|
pixfmt.colorkey = 0;
|
||||||
pixfmt.alpha = 0;
|
pixfmt.alpha = 0;
|
||||||
|
|
||||||
surf32 = SDL_ConvertSurface( surf, &pixfmt, SDL_SWSURFACE );
|
surf32 = SDL_ConvertSurface(surf, &pixfmt, SDL_SWSURFACE);
|
||||||
|
|
||||||
linesize = surf32->w*sizeof(Uint32);
|
linesize = surf32->w * sizeof(Uint32);
|
||||||
dst = (Uint8*)bitmap->Bits();
|
dst = (Uint8 *) bitmap->Bits();
|
||||||
src = (Uint8*)surf32->pixels;
|
src = (Uint8 *) surf32->pixels;
|
||||||
for ( i = 0; i < surf32->h; i++ )
|
for (i = 0; i < surf32->h; i++)
|
||||||
{
|
{
|
||||||
memcpy( dst, src, linesize );
|
memcpy(dst, src, linesize);
|
||||||
src += surf32->pitch-4;
|
src += surf32->pitch - 4;
|
||||||
dst += linesize;
|
dst += linesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_FreeSurface( surf32 ); /* Free temp surface */
|
SDL_FreeSurface(surf32); /* Free temp surface */
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IsPrinterAvailable( void )
|
int IsPrinterAvailable(void)
|
||||||
{
|
{
|
||||||
// this code is a little hack, i don't like such hardcoded things
|
// this code is a little hack, i don't like such hardcoded things
|
||||||
// but i have no choice ;]
|
// but i have no choice ;]
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *f = NULL;
|
struct dirent *f = NULL;
|
||||||
int num_files = 0;
|
int num_files = 0;
|
||||||
d = opendir("/boot/home/config/settings/printers");
|
|
||||||
if( d != NULL)
|
d = opendir("/boot/home/config/settings/printers");
|
||||||
{
|
if (d != NULL)
|
||||||
while( (f = readdir(d)) != NULL)
|
{
|
||||||
num_files++;
|
while ((f = readdir(d)) != NULL)
|
||||||
closedir( d);
|
num_files++;
|
||||||
if( num_files > 2)
|
closedir(d);
|
||||||
return 1;
|
if (num_files > 2)
|
||||||
}
|
return 1;
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SurfacePrint( SDL_Surface *surf )
|
int SurfacePrint(SDL_Surface * surf)
|
||||||
{
|
{
|
||||||
BWindow *window = new BWindow( BRect( 0, 0, surf->w, surf->h), "TuxPaint Print", B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS);
|
BWindow *window =
|
||||||
PrintView *view = new PrintView( SurfaceToBBitmap( surf));
|
new BWindow(BRect(0, 0, surf->w, surf->h), "TuxPaint Print", B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
window->AddChild(view);
|
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS);
|
||||||
window->Run();
|
PrintView *view = new PrintView(SurfaceToBBitmap(surf));
|
||||||
|
|
||||||
BPrintJob job("TuxPaint");
|
window->AddChild(view);
|
||||||
if( job.ConfigPage() == B_OK)
|
window->Run();
|
||||||
{
|
|
||||||
if( job.ConfigJob() == B_OK)
|
|
||||||
{
|
|
||||||
job.BeginJob();
|
|
||||||
if( job.CanContinue())
|
|
||||||
{
|
|
||||||
job.DrawView(view, BRect( 0, 0, surf->w, surf->h), BPoint( 0, 0));
|
|
||||||
job.SpoolPage();
|
|
||||||
}
|
|
||||||
if( job.CanContinue())
|
|
||||||
job.CommitJob();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BMessenger( window).SendMessage( B_QUIT_REQUESTED);
|
BPrintJob job("TuxPaint");
|
||||||
|
|
||||||
return 0;
|
if (job.ConfigPage() == B_OK)
|
||||||
|
{
|
||||||
|
if (job.ConfigJob() == B_OK)
|
||||||
|
{
|
||||||
|
job.BeginJob();
|
||||||
|
if (job.CanContinue())
|
||||||
|
{
|
||||||
|
job.DrawView(view, BRect(0, 0, surf->w, surf->h), BPoint(0, 0));
|
||||||
|
job.SpoolPage();
|
||||||
|
}
|
||||||
|
if (job.CanContinue())
|
||||||
|
job.CommitJob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BMessenger(window).SendMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
win32/.indent.pro
vendored
Symbolic link
1
win32/.indent.pro
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../src/.indent.pro
|
||||||
Loading…
Add table
Add a link
Reference in a new issue