initial program check in
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1045 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,102 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
// TGATranslator
|
||||||
|
//
|
||||||
|
// Version: 1.0.0 Beta
|
||||||
|
//
|
||||||
|
// This translator opens and writes TGA files.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// This application and all source files used in its construction, except
|
||||||
|
// where noted, are licensed under the MIT License, and have been written
|
||||||
|
// and are:
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 OpenBeOS Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Screen.h>
|
||||||
|
#include <Alert.h>
|
||||||
|
#include "TGATranslator.h"
|
||||||
|
#include "TGAWindow.h"
|
||||||
|
#include "TGAView.h"
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// main
|
||||||
|
//
|
||||||
|
// Creates a BWindow for displaying info about the TGATranslator
|
||||||
|
//
|
||||||
|
// Preconditions:
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// Postconditions:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
BApplication app("application/x-vnd.obos-tga-translator");
|
||||||
|
TGATranslator *ptranslator = new TGATranslator;
|
||||||
|
BView *view = NULL;
|
||||||
|
BRect rect(0, 0, 225, 175);
|
||||||
|
if (ptranslator->MakeConfigurationView(NULL, &view, &rect)) {
|
||||||
|
BAlert *err = new BAlert("Error",
|
||||||
|
"Unable to create the TGATranslator view.", "OK");
|
||||||
|
err->Go();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// release the translator even though I never really used it anyway
|
||||||
|
ptranslator->Release();
|
||||||
|
ptranslator = NULL;
|
||||||
|
|
||||||
|
TGAWindow *wnd = new TGAWindow(rect);
|
||||||
|
view->ResizeTo(rect.Width(), rect.Height());
|
||||||
|
wnd->AddChild(view);
|
||||||
|
BPoint wndpt = B_ORIGIN;
|
||||||
|
{
|
||||||
|
BScreen scrn;
|
||||||
|
BRect frame = scrn.Frame();
|
||||||
|
frame.InsetBy(10, 23);
|
||||||
|
// if the point is outside of the screen frame,
|
||||||
|
// use the mouse location to find a better point
|
||||||
|
if (!frame.Contains(wndpt)) {
|
||||||
|
uint32 dummy;
|
||||||
|
view->GetMouse(&wndpt, &dummy, false);
|
||||||
|
wndpt.x -= rect.Width() / 2;
|
||||||
|
wndpt.y -= rect.Height() / 2;
|
||||||
|
// clamp location to screen
|
||||||
|
if (wndpt.x < frame.left)
|
||||||
|
wndpt.x = frame.left;
|
||||||
|
if (wndpt.y < frame.top)
|
||||||
|
wndpt.y = frame.top;
|
||||||
|
if (wndpt.x > frame.right)
|
||||||
|
wndpt.x = frame.right;
|
||||||
|
if (wndpt.y > frame.bottom)
|
||||||
|
wndpt.y = frame.bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wnd->MoveTo(wndpt);
|
||||||
|
wnd->Show();
|
||||||
|
app.Run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,180 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
// TGATranslator
|
||||||
|
// TGATranslator.h
|
||||||
|
//
|
||||||
|
// This BTranslator based object is for opening and writing TGA files.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 OpenBeOS Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TGA_TRANSLATOR_H
|
||||||
|
#define TGA_TRANSLATOR_H
|
||||||
|
|
||||||
|
#include <Translator.h>
|
||||||
|
#include <TranslatorFormats.h>
|
||||||
|
#include <TranslationDefs.h>
|
||||||
|
#include <GraphicsDefs.h>
|
||||||
|
#include <InterfaceDefs.h>
|
||||||
|
#include <DataIO.h>
|
||||||
|
#include <ByteOrder.h>
|
||||||
|
|
||||||
|
#define TGA_TRANSLATOR_VERSION 100
|
||||||
|
#define TGA_IN_QUALITY 1.0
|
||||||
|
// high in quality becuase this code supports all TGA features
|
||||||
|
#define TGA_IN_CAPABILITY 0.8
|
||||||
|
// high in capability because this code opens basically all TGAs
|
||||||
|
#define TGA_OUT_QUALITY 1.0
|
||||||
|
// high out quality because this code outputs fully standard TGAs
|
||||||
|
#define TGA_OUT_CAPABILITY 0.5
|
||||||
|
// medium out capability because RLE compression is not an option
|
||||||
|
|
||||||
|
#define BBT_IN_QUALITY 0.6
|
||||||
|
// medium in quality because only most common features are supported
|
||||||
|
#define BBT_IN_CAPABILITY 0.8
|
||||||
|
// high in capability because most variations are supported
|
||||||
|
#define BBT_OUT_QUALITY 0.6
|
||||||
|
// medium out quality because only most common features are supported
|
||||||
|
#define BBT_OUT_CAPABILITY 0.8
|
||||||
|
// high out capability because most variations are supported
|
||||||
|
|
||||||
|
// TGA files are stored in the Intel byte order :)
|
||||||
|
struct TGAFileHeader {
|
||||||
|
uint8 idlength; // Number of bytes in the Image ID field
|
||||||
|
uint8 colormaptype;
|
||||||
|
// 0 Has NO color-map (palette)
|
||||||
|
// 1 Has color-map (palette)
|
||||||
|
|
||||||
|
uint8 imagetype;
|
||||||
|
// 0 No Image Data Included
|
||||||
|
// 1 Uncompressed, Color-mapped image
|
||||||
|
// 2 Uncompressed, True-color image
|
||||||
|
// 3 Uncompressed, Black-and-white (Greyscale?) image
|
||||||
|
// 9 Run-length encoded, Color-mapped image
|
||||||
|
// 10 Run-length encoded, True-color image
|
||||||
|
// 11 Run-length encoded, Black-and-white (Greyscale?) image
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TGA_NO_COLORMAP 0
|
||||||
|
#define TGA_COLORMAP 1
|
||||||
|
|
||||||
|
#define TGA_NO_IMAGE_DATA 0
|
||||||
|
|
||||||
|
#define TGA_NOCOMP_COLORMAP 1
|
||||||
|
#define TGA_NOCOMP_TRUECOLOR 2
|
||||||
|
#define TGA_NOCOMP_BW 3
|
||||||
|
|
||||||
|
#define TGA_RLE_COLORMAP 9
|
||||||
|
#define TGA_RLE_TRUECOLOR 10
|
||||||
|
#define TGA_RLE_BW 11
|
||||||
|
|
||||||
|
// Information about the color map (palette)
|
||||||
|
// these bytes are always present, but are zero if no color map
|
||||||
|
// is present
|
||||||
|
struct TGAColorMapSpec {
|
||||||
|
uint16 firstentry; // first useful entry in the color map
|
||||||
|
uint16 length; // number of color map entries
|
||||||
|
uint8 entrysize; // number of bits per entry
|
||||||
|
};
|
||||||
|
|
||||||
|
// Information about the image data
|
||||||
|
struct TGAImageSpec {
|
||||||
|
uint16 xorigin;
|
||||||
|
uint16 yorigin;
|
||||||
|
uint16 width;
|
||||||
|
uint16 height;
|
||||||
|
uint8 depth; // pixel depth includes alpha!
|
||||||
|
uint8 descriptor;
|
||||||
|
// bits 3-0: number of attribute bits per pixel
|
||||||
|
// bits 5&4: order pixels are drawn to the screen
|
||||||
|
// Screen Dest of Image Origin
|
||||||
|
// first pixel bit 5 bit 4
|
||||||
|
//////////////////////////////////////////
|
||||||
|
// bottom left 0 0
|
||||||
|
// bottom right 0 1
|
||||||
|
// top left 1 0
|
||||||
|
// top right 1 1
|
||||||
|
// bits 7&6: must be zero
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TGA_ORIGIN_VERT_BIT 0x20
|
||||||
|
#define TGA_ORIGIN_BOTTOM 0
|
||||||
|
#define TGA_ORIGIN_TOP 1
|
||||||
|
|
||||||
|
#define TGA_ORIGIN_HORZ_BIT 0x10
|
||||||
|
#define TGA_ORIGIN_LEFT 0
|
||||||
|
#define TGA_ORIGIN_RIGHT 1
|
||||||
|
|
||||||
|
#define TGA_HEADERS_SIZE 18
|
||||||
|
|
||||||
|
class TGATranslator : public BTranslator {
|
||||||
|
public:
|
||||||
|
TGATranslator();
|
||||||
|
|
||||||
|
virtual const char *TranslatorName() const;
|
||||||
|
// returns the short name of the translator
|
||||||
|
|
||||||
|
virtual const char *TranslatorInfo() const;
|
||||||
|
// returns a verbose name/description for the translator
|
||||||
|
|
||||||
|
virtual int32 TranslatorVersion() const;
|
||||||
|
// returns the version of the translator
|
||||||
|
|
||||||
|
virtual const translation_format *InputFormats(int32 *out_count)
|
||||||
|
const;
|
||||||
|
// returns the input formats and the count of input formats
|
||||||
|
// that this translator supports
|
||||||
|
|
||||||
|
virtual const translation_format *OutputFormats(int32 *out_count)
|
||||||
|
const;
|
||||||
|
// returns the output formats and the count of output formats
|
||||||
|
// that this translator supports
|
||||||
|
|
||||||
|
virtual status_t Identify(BPositionIO *inSource,
|
||||||
|
const translation_format *inFormat, BMessage *ioExtension,
|
||||||
|
translator_info *outInfo, uint32 outType);
|
||||||
|
// determines whether or not this translator can convert the
|
||||||
|
// data in inSource to the type outType
|
||||||
|
|
||||||
|
virtual status_t Translate(BPositionIO *inSource,
|
||||||
|
const translator_info *inInfo, BMessage *ioExtension,
|
||||||
|
uint32 outType, BPositionIO *outDestination);
|
||||||
|
// this function is the whole point of the Translation Kit,
|
||||||
|
// it translates the data in inSource to outDestination
|
||||||
|
// using the format outType
|
||||||
|
|
||||||
|
virtual status_t MakeConfigurationView(BMessage *ioExtension,
|
||||||
|
BView **outView, BRect *outExtent);
|
||||||
|
// creates and returns the view for displaying information
|
||||||
|
// about this translator
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~TGATranslator();
|
||||||
|
// this is protected because the object is deleted by the
|
||||||
|
// Release() function instead of being deleted directly by
|
||||||
|
// the user
|
||||||
|
|
||||||
|
private:
|
||||||
|
char fName[30];
|
||||||
|
char fInfo[100];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // #ifndef TGA_TRANSLATOR_H
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
// TGAView
|
||||||
|
// TGAView.cpp
|
||||||
|
//
|
||||||
|
// This BView based object displays information about the TGATranslator.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 OpenBeOS Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "TGAView.h"
|
||||||
|
#include "TGATranslator.h"
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
//
|
||||||
|
// Sets up the view settings
|
||||||
|
//
|
||||||
|
// Preconditions:
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// Postconditions:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
TGAView::TGAView(const BRect &frame, const char *name,
|
||||||
|
uint32 resize, uint32 flags)
|
||||||
|
: BView(frame, name, resize, flags)
|
||||||
|
{
|
||||||
|
SetViewColor(220,220,220,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// Destructor
|
||||||
|
//
|
||||||
|
// Does nothing
|
||||||
|
//
|
||||||
|
// Preconditions:
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// Postconditions:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
TGAView::~TGAView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// Draw
|
||||||
|
//
|
||||||
|
// Draws information about the TGATranslator to this view.
|
||||||
|
//
|
||||||
|
// Preconditions:
|
||||||
|
//
|
||||||
|
// Parameters: area, not used
|
||||||
|
//
|
||||||
|
// Postconditions:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
void
|
||||||
|
TGAView::Draw(BRect area)
|
||||||
|
{
|
||||||
|
SetFont(be_bold_font);
|
||||||
|
font_height fh;
|
||||||
|
GetFontHeight(&fh);
|
||||||
|
float xbold, ybold;
|
||||||
|
xbold = fh.descent + 1;
|
||||||
|
ybold = fh.ascent + fh.descent * 2 + fh.leading;
|
||||||
|
|
||||||
|
char title[] = "OpenBeOS TGA Image Translator";
|
||||||
|
DrawString(title, BPoint(xbold, ybold));
|
||||||
|
|
||||||
|
SetFont(be_plain_font);
|
||||||
|
font_height plainh;
|
||||||
|
GetFontHeight(&plainh);
|
||||||
|
float yplain;
|
||||||
|
yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;
|
||||||
|
|
||||||
|
char detail[100];
|
||||||
|
sprintf(detail, "Version %d.%d.%d %s",
|
||||||
|
TGA_TRANSLATOR_VERSION / 100, (TGA_TRANSLATOR_VERSION / 10) % 10,
|
||||||
|
TGA_TRANSLATOR_VERSION % 10, __DATE__);
|
||||||
|
DrawString(detail, BPoint(xbold, yplain + ybold));
|
||||||
|
/* char copyright[] = "© 2002 OpenBeOS Project";
|
||||||
|
DrawString(copyright, BPoint(xbold, yplain * 2 + ybold));
|
||||||
|
|
||||||
|
char becopyright[] = "Portions Copyright 1991-1999, Be Incorporated.";
|
||||||
|
DrawString(becopyright, BPoint(xbold, yplain * 4 + ybold));
|
||||||
|
char allrights[] = "All rights reserved.";
|
||||||
|
DrawString(allrights, BPoint(xbold, yplain * 5 + ybold));
|
||||||
|
*/
|
||||||
|
char writtenby[] = "Written by the OBOS Translation Kit Team";
|
||||||
|
DrawString(writtenby, BPoint(xbold, yplain * 7 + ybold));
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
// TGAView
|
||||||
|
// TGAView.h
|
||||||
|
//
|
||||||
|
// This BView based object displays information about the TGATranslator.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 OpenBeOS Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TGAVIEW_H
|
||||||
|
#define TGAVIEW_H
|
||||||
|
|
||||||
|
#include <View.h>
|
||||||
|
#include <MenuField.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
|
|
||||||
|
class TGAView : public BView {
|
||||||
|
public:
|
||||||
|
TGAView(const BRect &frame, const char *name, uint32 resize,
|
||||||
|
uint32 flags);
|
||||||
|
// sets up the view
|
||||||
|
|
||||||
|
~TGAView();
|
||||||
|
// does nothing
|
||||||
|
|
||||||
|
virtual void Draw(BRect area);
|
||||||
|
// draws information about the TGATranslator
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // #ifndef TGAVIEW_H
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
// TGAWindow
|
||||||
|
// TGAWindow.cpp
|
||||||
|
//
|
||||||
|
// This BWindow based object is used to hold the TGAView object when the
|
||||||
|
// user runs the TGATranslator as an application.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 OpenBeOS Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include "TGAWindow.h"
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
//
|
||||||
|
// Sets up the BWindow for holding a TGAView
|
||||||
|
//
|
||||||
|
// Preconditions:
|
||||||
|
//
|
||||||
|
// Parameters: area, The bounds of the window
|
||||||
|
//
|
||||||
|
// Postconditions:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
TGAWindow::TGAWindow(BRect area)
|
||||||
|
: BWindow(area, "TGATranslator", B_TITLED_WINDOW,
|
||||||
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// Destructor
|
||||||
|
//
|
||||||
|
// Posts a quit message so that the application is close properly
|
||||||
|
//
|
||||||
|
// Preconditions:
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// Postconditions:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
TGAWindow::~TGAWindow()
|
||||||
|
{
|
||||||
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
// TGAWindow
|
||||||
|
// TGAWindow.h
|
||||||
|
//
|
||||||
|
// This BWindow based object is used to hold the TGAView object when the
|
||||||
|
// user runs the TGATranslator as an application.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 OpenBeOS Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TGAWINDOW_H
|
||||||
|
#define TGAWINDOW_H
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Window.h>
|
||||||
|
#include <View.h>
|
||||||
|
|
||||||
|
class TGAWindow : public BWindow {
|
||||||
|
public:
|
||||||
|
TGAWindow(BRect area);
|
||||||
|
// Sets up a BWindow with bounds area
|
||||||
|
|
||||||
|
~TGAWindow();
|
||||||
|
// Posts a quit message so that the application closes properly
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user