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. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
#include "TIFFView.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -46,7 +49,6 @@
#include "TIFFTranslator.h" #include "TIFFTranslator.h"
#include "TranslatorSettings.h" #include "TranslatorSettings.h"
#include "TIFFView.h"
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "TIFFView" #define B_TRANSLATION_CONTEXT "TIFFView"
@@ -66,22 +68,11 @@ add_menu_item(BMenu* menu,
menu->AddItem(item); menu->AddItem(item);
} }
// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
TIFFView::TIFFView(const char* name, uint32 flags, TIFFView::TIFFView(const char* name, uint32 flags,
TranslatorSettings* settings) TranslatorSettings* settings)
: BView(name, flags) :
BView(name, flags)
{ {
fSettings = settings; fSettings = settings;
@@ -144,45 +135,33 @@ TIFFView::TIFFView(const char *name, uint32 flags,
.Add(fLibTIFF[2]) .Add(fLibTIFF[2])
.Add(fLibTIFF[3]) .Add(fLibTIFF[3])
// Theses 4 adding above work because we know there are 4 strings // 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(); .AddGlue();
BFont font; BFont font;
GetFont(&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() TIFFView::~TIFFView()
{ {
fSettings->Release(); fSettings->Release();
} }
// ---------------------------------------------------------------
// MessageReceived void
// TIFFView::AllAttached()
// Handles state changes of the Compression menu field {
// fCompressionMF->Menu()->SetTargetForItems(this);
// Preconditions: fCompressionMF->SetDivider(
// fCompressionMF->StringWidth(fCompressionMF->Label()) + 3);
// Parameters: area, not used fCompressionMF->ResizeToPreferred();
// }
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
void void
TIFFView::MessageReceived(BMessage* message) TIFFView::MessageReceived(BMessage* message)
{ {
@@ -199,26 +178,3 @@ TIFFView::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
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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
#ifndef TIFFVIEW_H #ifndef TIFFVIEW_H
#define TIFFVIEW_H #define TIFFVIEW_H
#include <View.h> #include <View.h>
#include <MenuField.h> #include <MenuField.h>
#include <StringView.h> #include <StringView.h>
#include "TranslatorSettings.h" #include "TranslatorSettings.h"
class TIFFView : public BView { class TIFFView : public BView {
public: public:
TIFFView(const char* name, uint32 flags, TranslatorSettings* settings); TIFFView(const char* name, uint32 flags, TranslatorSettings* settings);
@@ -59,8 +60,8 @@ 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 TIFFVIEW_H #endif // #ifndef TIFFVIEW_H