TIFFTranslator: Style fixes to TIFFView

This commit is contained in:
John Scipione
2013-05-30 17:24:37 -04:00
parent 44efd20581
commit 16ccdab9c9
2 changed files with 62 additions and 105 deletions
+22 -66
View File
@@ -30,6 +30,9 @@
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#include "TIFFView.h"
#include <stdio.h>
#include <string.h>
@@ -46,7 +49,6 @@
#include "TIFFTranslator.h"
#include "TranslatorSettings.h"
#include "TIFFView.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "TIFFView"
@@ -66,22 +68,11 @@ add_menu_item(BMenu* menu,
menu->AddItem(item);
}
// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
TIFFView::TIFFView(const char* name, uint32 flags,
TranslatorSettings* settings)
: BView(name, flags)
:
BView(name, flags)
{
fSettings = settings;
@@ -144,45 +135,33 @@ TIFFView::TIFFView(const char *name, uint32 flags,
.Add(fLibTIFF[2])
.Add(fLibTIFF[3])
// Theses 4 adding above work because we know there are 4 strings
// but it's fragile: one string less in the library version and the application breaks
// but it's fragile: one string less in the library version and the
// application breaks
.AddGlue();
BFont font;
GetFont(&font);
SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
SetExplicitPreferredSize(
BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
}
// ---------------------------------------------------------------
// Destructor
//
// Does nothing
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
TIFFView::~TIFFView()
{
fSettings->Release();
}
// ---------------------------------------------------------------
// MessageReceived
//
// Handles state changes of the Compression menu field
//
// Preconditions:
//
// Parameters: area, not used
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
void
TIFFView::AllAttached()
{
fCompressionMF->Menu()->SetTargetForItems(this);
fCompressionMF->SetDivider(
fCompressionMF->StringWidth(fCompressionMF->Label()) + 3);
fCompressionMF->ResizeToPreferred();
}
void
TIFFView::MessageReceived(BMessage* message)
{
@@ -199,26 +178,3 @@ TIFFView::MessageReceived(BMessage* message)
BView::MessageReceived(message);
}
}
// ---------------------------------------------------------------
// AllAttached
//
// sets the target for the controls controlling the configuration
//
// Preconditions:
//
// Parameters: area, not used
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
void
TIFFView::AllAttached()
{
fCompressionMF->Menu()->SetTargetForItems(this);
fCompressionMF->SetDivider(fCompressionMF->StringWidth(fCompressionMF->Label()) + 3);
fCompressionMF->ResizeToPreferred();
}
+4 -3
View File
@@ -28,15 +28,16 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#ifndef TIFFVIEW_H
#define TIFFVIEW_H
#include <View.h>
#include <MenuField.h>
#include <StringView.h>
#include "TranslatorSettings.h"
class TIFFView : public BView {
public:
TIFFView(const char* name, uint32 flags, TranslatorSettings* settings);
@@ -59,8 +60,8 @@ private:
BMenuField* fCompressionMF;
TranslatorSettings* fSettings;
// the actual settings for the translator,
// shared with the translator
// the actual settings for the translator, shared with the translator
};
#endif // #ifndef TIFFVIEW_H