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.
/*****************************************************************************/
#include "SGIView.h"
#include <stdio.h>
#include <string.h>
@@ -46,13 +49,14 @@
#include "SGIImage.h"
#include "SGITranslator.h"
#include "SGIView.h"
const char* author = "Stephan Aßmus, <[email protected]>";
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "SGIView"
// add_menu_item
void
add_menu_item(BMenu* menu,
@@ -67,19 +71,7 @@ add_menu_item(BMenu* menu,
menu->AddItem(item);
}
// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
:
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
add_menu_item(menu, SGI_COMP_NONE, B_TRANSLATE("None"),
currentCompression);
// menu->AddSeparatorItem();
//menu->AddSeparatorItem();
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
// 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
// modify the scanline tables so that the current row is not written
// at all...
// 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.
// Supposedly, this would look for an already written scanline, and
// modify the scanline tables so that the current row is not written
// 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",
B_TRANSLATE("Use compression:"), menu);
@@ -144,8 +136,8 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
BFont font;
GetFont(&font);
SetExplicitPreferredSize(
BSize((font.Size() * 390) / 12, (font.Size() * 180) / 12));
SetExplicitPreferredSize(BSize((font.Size() * 390) / 12,
(font.Size() * 180) / 12));
// TODO: remove this workaround for ticket #4217
infoView->SetExplicitPreferredSize(
@@ -155,37 +147,19 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
}
// ---------------------------------------------------------------
// Destructor
//
// Does nothing
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SGIView::~SGIView()
{
fSettings->Release();
}
// ---------------------------------------------------------------
// MessageReceived
//
// Handles state changes of the Compression menu field
//
// Preconditions:
//
// Parameters: area, not used
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
void
SGIView::AllAttached()
{
fCompressionMF->Menu()->SetTargetForItems(this);
}
void
SGIView::MessageReceived(BMessage* message)
{
@@ -203,23 +177,3 @@ SGIView::MessageReceived(BMessage* 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);
}
+14 -12
View File
@@ -29,36 +29,38 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#ifndef SGIVIEW_H
#define SGIVIEW_H
#include <View.h>
#include "TranslatorSettings.h"
class BMenuField;
class SGIView : public BView {
public:
SGIView(const char* name, uint32 flags, TranslatorSettings* settings);
// sets up the view
~SGIView();
// releases the SGITranslator settings
SGIView(const char* name, uint32 flags, TranslatorSettings* settings);
// sets up the view
virtual void AllAttached();
virtual void MessageReceived(BMessage* message);
~SGIView();
// releases the SGITranslator settings
virtual void AllAttached();
virtual void MessageReceived(BMessage* message);
enum {
MSG_COMPRESSION_CHANGED = 'cmch',
};
private:
BMenuField* fCompressionMF;
BMenuField* fCompressionMF;
TranslatorSettings* fSettings;
// the actual settings for the translator,
// shared with the translator
TranslatorSettings* fSettings;
// the actual settings for the translator, shared with the translator
};
#endif // #ifndef SGIVIEW_H