SGITranslator: style fixes for SGIView

This commit is contained in:
John Scipione
2013-05-30 17:19:44 -04:00
parent 14701d3ec9
commit 44efd20581
2 changed files with 37 additions and 81 deletions
+23 -69
View File
@@ -30,6 +30,9 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
#include "SGIView.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -46,13 +49,14 @@
#include "SGIImage.h" #include "SGIImage.h"
#include "SGITranslator.h" #include "SGITranslator.h"
#include "SGIView.h"
const char* author = "Stephan Aßmus, <[email protected]>"; const char* author = "Stephan Aßmus, <[email protected]>";
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "SGIView" #define B_TRANSLATION_CONTEXT "SGIView"
// add_menu_item // add_menu_item
void void
add_menu_item(BMenu* menu, add_menu_item(BMenu* menu,
@@ -67,19 +71,7 @@ add_menu_item(BMenu* menu,
menu->AddItem(item); menu->AddItem(item);
} }
// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
: :
BView(name, flags, new BGroupLayout(B_VERTICAL)), BView(name, flags, new BGroupLayout(B_VERTICAL)),
@@ -92,16 +84,16 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
// create the menu items with the various compression methods // create the menu items with the various compression methods
add_menu_item(menu, SGI_COMP_NONE, B_TRANSLATE("None"), add_menu_item(menu, SGI_COMP_NONE, B_TRANSLATE("None"),
currentCompression); currentCompression);
// menu->AddSeparatorItem(); //menu->AddSeparatorItem();
add_menu_item(menu, SGI_COMP_RLE, B_TRANSLATE("RLE"), currentCompression); add_menu_item(menu, SGI_COMP_RLE, B_TRANSLATE("RLE"), currentCompression);
// DON'T turn this on, it's so slow that I didn't wait long enough // DON'T turn this on, it's so slow that I didn't wait long enough
// the one time I tested this. So I don't know if the code even works. // the one time I tested this. So I don't know if the code even works.
// Supposedly, this would look for an already written scanline, and // Supposedly, this would look for an already written scanline, and
// modify the scanline tables so that the current row is not written // modify the scanline tables so that the current row is not written
// at all... // at all...
// add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression); //add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression);
fCompressionMF = new BMenuField("compression", fCompressionMF = new BMenuField("compression",
B_TRANSLATE("Use compression:"), menu); B_TRANSLATE("Use compression:"), menu);
@@ -144,8 +136,8 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
BFont font; BFont font;
GetFont(&font); GetFont(&font);
SetExplicitPreferredSize( SetExplicitPreferredSize(BSize((font.Size() * 390) / 12,
BSize((font.Size() * 390) / 12, (font.Size() * 180) / 12)); (font.Size() * 180) / 12));
// TODO: remove this workaround for ticket #4217 // TODO: remove this workaround for ticket #4217
infoView->SetExplicitPreferredSize( infoView->SetExplicitPreferredSize(
@@ -155,37 +147,19 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
} }
// ---------------------------------------------------------------
// Destructor
//
// Does nothing
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SGIView::~SGIView() SGIView::~SGIView()
{ {
fSettings->Release(); fSettings->Release();
} }
// ---------------------------------------------------------------
// MessageReceived void
// SGIView::AllAttached()
// Handles state changes of the Compression menu field {
// fCompressionMF->Menu()->SetTargetForItems(this);
// Preconditions: }
//
// Parameters: area, not used
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
void void
SGIView::MessageReceived(BMessage* message) SGIView::MessageReceived(BMessage* message)
{ {
@@ -203,23 +177,3 @@ SGIView::MessageReceived(BMessage* message)
BView::MessageReceived(message); BView::MessageReceived(message);
} }
} }
// ---------------------------------------------------------------
// AllAttached
//
// sets the target for the controls controlling the configuration
//
// Preconditions:
//
// Parameters: area, not used
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
void
SGIView::AllAttached()
{
fCompressionMF->Menu()->SetTargetForItems(this);
}
+13 -11
View File
@@ -29,36 +29,38 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
#ifndef SGIVIEW_H #ifndef SGIVIEW_H
#define SGIVIEW_H #define SGIVIEW_H
#include <View.h> #include <View.h>
#include "TranslatorSettings.h" #include "TranslatorSettings.h"
class BMenuField; class BMenuField;
class SGIView : public BView { class SGIView : public BView {
public: public:
SGIView(const char* name, uint32 flags, TranslatorSettings* settings); SGIView(const char* name, uint32 flags, TranslatorSettings* settings);
// sets up the view // sets up the view
~SGIView(); ~SGIView();
// releases the SGITranslator settings // releases the SGITranslator settings
virtual void AllAttached(); virtual void AllAttached();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
enum { enum {
MSG_COMPRESSION_CHANGED = 'cmch', MSG_COMPRESSION_CHANGED = 'cmch',
}; };
private: private:
BMenuField* fCompressionMF; BMenuField* fCompressionMF;
TranslatorSettings* fSettings; TranslatorSettings* fSettings;
// the actual settings for the translator, // the actual settings for the translator, shared with the translator
// shared with the translator
}; };
#endif // #ifndef SGIVIEW_H #endif // #ifndef SGIVIEW_H