From 72cb92ebd0f5e869291416b2d7ffa2d66bea2d51 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Sun, 28 Jul 2002 20:44:31 +0000 Subject: [PATCH] added some comments git-svn-id: file:///srv/svn/repos/haiku/trunk/current@521 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../translators/bmptranslator/BMPMain.cpp | 49 +++++++++++- .../translators/bmptranslator/BMPTranslator.h | 28 ++++++- .../translators/bmptranslator/BMPView.cpp | 75 ++++++++++++++++++- .../translators/bmptranslator/BMPView.h | 36 ++++++++- .../translators/bmptranslator/BMPWindow.cpp | 58 +++++++++++++- .../translators/bmptranslator/BMPWindow.h | 30 ++++++++ 6 files changed, 264 insertions(+), 12 deletions(-) diff --git a/src/add-ons/translators/bmptranslator/BMPMain.cpp b/src/add-ons/translators/bmptranslator/BMPMain.cpp index 73d5b20931..c394df37f0 100644 --- a/src/add-ons/translators/bmptranslator/BMPMain.cpp +++ b/src/add-ons/translators/bmptranslator/BMPMain.cpp @@ -1,4 +1,35 @@ -// BMPMain.cpp +/*****************************************************************************/ +// BMPTranslator +// +// Version: 1.0.0 Beta +// +// This translator opens and writes BMP 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 #include @@ -7,7 +38,21 @@ #include "BMPWindow.h" #include "BMPView.h" -int main() +// --------------------------------------------------------------- +// main +// +// Creates a BWindow for displaying info about the BMPTranslator +// +// Preconditions: +// +// Parameters: +// +// Postconditions: +// +// Returns: +// --------------------------------------------------------------- +int +main() { BApplication app("application/x-vnd.obos-bmp-translator"); BMPTranslator *ptranslator = new BMPTranslator; diff --git a/src/add-ons/translators/bmptranslator/BMPTranslator.h b/src/add-ons/translators/bmptranslator/BMPTranslator.h index cb9b0600cf..385e120370 100644 --- a/src/add-ons/translators/bmptranslator/BMPTranslator.h +++ b/src/add-ons/translators/bmptranslator/BMPTranslator.h @@ -1,4 +1,30 @@ +/*****************************************************************************/ +// BMPTranslator // BMPTranslator.h +// +// This BTranslator based object is for opening and writing BMP 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 BMP_TRANSLATOR_H #define BMP_TRANSLATOR_H @@ -45,7 +71,7 @@ struct MSInfoHeader { }; struct OS2InfoHeader { - uint32 size; // size of this struct (40) + uint32 size; // size of this struct (12) uint16 width; // bitmap width uint16 height; // bitmap height uint16 planes; // number of planes, always 1? diff --git a/src/add-ons/translators/bmptranslator/BMPView.cpp b/src/add-ons/translators/bmptranslator/BMPView.cpp index 49cdb4525b..560ac76ccd 100644 --- a/src/add-ons/translators/bmptranslator/BMPView.cpp +++ b/src/add-ons/translators/bmptranslator/BMPView.cpp @@ -1,21 +1,88 @@ +/*****************************************************************************/ +// BMPView // BMPView.cpp +// +// This BView based object displays information about the BMPTranslator. +// +// +// 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 #include #include "BMPView.h" #include "BMPTranslator.h" -BMPView::BMPView(const BRect &frame, const char *name, uint32 resize, uint32 flags) : - BView(frame, name, resize, flags) +// --------------------------------------------------------------- +// Constructor +// +// Sets up the view settings +// +// Preconditions: +// +// Parameters: +// +// Postconditions: +// +// Returns: +// --------------------------------------------------------------- +BMPView::BMPView(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: +// --------------------------------------------------------------- BMPView::~BMPView() { } -void BMPView::Draw(BRect area) +// --------------------------------------------------------------- +// Draw +// +// Draws information about the BMPTranslator to this view. +// +// Preconditions: +// +// Parameters: area, not used +// +// Postconditions: +// +// Returns: +// --------------------------------------------------------------- +void +BMPView::Draw(BRect area) { SetFont(be_bold_font); font_height fh; diff --git a/src/add-ons/translators/bmptranslator/BMPView.h b/src/add-ons/translators/bmptranslator/BMPView.h index e7bdc32c6f..0f1bdc7b41 100644 --- a/src/add-ons/translators/bmptranslator/BMPView.h +++ b/src/add-ons/translators/bmptranslator/BMPView.h @@ -1,4 +1,30 @@ +/*****************************************************************************/ +// BMPView // BMPView.h +// +// This BView based object displays information about the BMPTranslator. +// +// +// 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 BMPVIEW_H #define BMPVIEW_H @@ -7,13 +33,17 @@ #include #include -class BMPView : public BView -{ +class BMPView : public BView { public: - BMPView(const BRect &frame, const char *name, uint32 resize, uint32 flags); + BMPView(const BRect &frame, const char *name, uint32 resize, + uint32 flags); + // sets up the view + ~BMPView(); + // does nothing virtual void Draw(BRect area); + // draws information about the BMPTranslator }; #endif // #ifndef BMPVIEW_H diff --git a/src/add-ons/translators/bmptranslator/BMPWindow.cpp b/src/add-ons/translators/bmptranslator/BMPWindow.cpp index 69320fcbbc..1a650bf0be 100644 --- a/src/add-ons/translators/bmptranslator/BMPWindow.cpp +++ b/src/add-ons/translators/bmptranslator/BMPWindow.cpp @@ -1,12 +1,66 @@ +/*****************************************************************************/ +// BMPWindow // BMPWindow.cpp +// +// This BWindow based object is used to hold the BMPView object when the +// user runs the BMPTranslator 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 "BMPWindow.h" -BMPWindow::BMPWindow(BRect area) : - BWindow(area, "BMPTranslator", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) +// --------------------------------------------------------------- +// Constructor +// +// Sets up the BWindow for holding a BMPView +// +// Preconditions: +// +// Parameters: area, The bounds of the window +// +// Postconditions: +// +// Returns: +// --------------------------------------------------------------- +BMPWindow::BMPWindow(BRect area) + : BWindow(area, "BMPTranslator", 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: +// --------------------------------------------------------------- BMPWindow::~BMPWindow() { be_app->PostMessage(B_QUIT_REQUESTED); diff --git a/src/add-ons/translators/bmptranslator/BMPWindow.h b/src/add-ons/translators/bmptranslator/BMPWindow.h index 8bd09ca9a1..31541df7c1 100644 --- a/src/add-ons/translators/bmptranslator/BMPWindow.h +++ b/src/add-ons/translators/bmptranslator/BMPWindow.h @@ -1,4 +1,31 @@ +/*****************************************************************************/ +// BMPWindow // BMPWindow.h +// +// This BWindow based object is used to hold the BMPView object when the +// user runs the BMPTranslator 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 BMPWINDOW_H #define BMPWINDOW_H @@ -10,7 +37,10 @@ class BMPWindow : public BWindow { public: BMPWindow(BRect area); + // Sets up a BWindow with bounds area + ~BMPWindow(); + // Posts a quit message so that the application closes properly }; #endif \ No newline at end of file