git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10791 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway
2005-01-17 08:35:56 +00:00
parent 80b0522e29
commit 098ad0a57f
16 changed files with 333 additions and 183 deletions
+33 -28
View File
@@ -15,39 +15,26 @@
ButtonView::ButtonView(BRect rect) ButtonView::ButtonView(BRect rect)
:BView(rect, "ButtonView", B_FOLLOW_ALL, B_WILL_DRAW) :BView(rect, "ButtonView", B_FOLLOW_ALL, B_WILL_DRAW)
{ {
float x;
float y;
BRect viewSize = Bounds();
BButton *rescanButton;
BButton *defaultsButton;
x = viewSize.Width() / 37;
y = viewSize.Height() / 6;
SetViewColor(216,216,216,0); SetViewColor(216,216,216,0);
rescanButton = new BButton(*(new BRect(x, y, (9.0 * x), (4.0 * y))), BRect btnRect(0, 0, 75, 25);
"rescanButton", btnRect.OffsetBy(10, 8);
"Rescan", BButton *rescanButton = new BButton(btnRect,
"rescanButton", "Rescan",
new BMessage(RESCAN_FONTS_MSG), new BMessage(RESCAN_FONTS_MSG),
B_FOLLOW_LEFT, B_FOLLOW_LEFT, B_WILL_DRAW);
B_WILL_DRAW
); btnRect.OffsetBy(96, 0);
defaultsButton = new BButton(*(new BRect((11.0 * x), y, (19.0 * x), (4.0 * y))), BButton *defaultsButton = new BButton(btnRect,
"defaultsButton", "defaultsButton", "Defaults",
"Defaults",
new BMessage(RESET_FONTS_MSG), new BMessage(RESET_FONTS_MSG),
B_FOLLOW_LEFT, B_FOLLOW_LEFT, B_WILL_DRAW);
B_WILL_DRAW
); btnRect.OffsetBy(85, 0);
revertButton = new BButton(*(new BRect((20.0 * x), y, (28.0 * x), (4.0 * y))), revertButton = new BButton(btnRect,
"revertButton", "revertButton", "Revert",
"Revert",
new BMessage(REVERT_MSG), new BMessage(REVERT_MSG),
B_FOLLOW_LEFT, B_FOLLOW_LEFT, B_WILL_DRAW);
B_WILL_DRAW
);
revertButton->SetEnabled(false); revertButton->SetEnabled(false);
@@ -57,6 +44,24 @@ ButtonView::ButtonView(BRect rect)
} }
void
ButtonView::Draw(BRect update)
{
rgb_color dark = {100, 100, 100, 255};
rgb_color light = {255, 255, 255, 255};
BRect bounds(Bounds());
BeginLineArray(6);
AddLine(bounds.LeftTop(), bounds.RightTop(), light);
AddLine(bounds.LeftTop(), bounds.LeftBottom(), light);
AddLine(bounds.RightTop(), bounds.RightBottom(), dark);
AddLine(bounds.RightBottom(), bounds.LeftBottom(), dark);
AddLine(BPoint(95, 9), BPoint(95, 34), dark);
AddLine(BPoint(96, 9), BPoint(96, 34), light);
EndLineArray();
}
/** /**
* Returns the state of the revert button. * Returns the state of the revert button.
*/ */
+1 -5
View File
@@ -21,12 +21,8 @@
*/ */
#define REVERT_MSG 'rvrt' #define REVERT_MSG 'rvrt'
#ifndef _VIEW_H
#include <View.h> #include <View.h>
#endif
#ifndef _BUTTON_H #ifndef _BUTTON_H
#include <Button.h> #include <Button.h>
@@ -40,7 +36,7 @@
ButtonView(BRect frame); ButtonView(BRect frame);
bool RevertState(); bool RevertState();
void SetRevertState(bool b); void SetRevertState(bool b);
void Draw(BRect);
private: private:
/** /**
+49 -59
View File
@@ -6,6 +6,10 @@
#include "CacheView.h" #include "CacheView.h"
#endif #endif
#include <String.h>
#include "Pref_Utils.h"
const char *kLabel = "font cache size: ";
/** /**
* Constructor * Constructor
@@ -18,73 +22,64 @@
CacheView::CacheView(BRect rect, int minVal, int maxVal, int32 printCurrVal, int32 screenCurrVal) CacheView::CacheView(BRect rect, int minVal, int maxVal, int32 printCurrVal, int32 screenCurrVal)
:BView(rect, "CacheView", B_FOLLOW_ALL, B_WILL_DRAW) :BView(rect, "CacheView", B_FOLLOW_ALL, B_WILL_DRAW)
{ {
SetViewColor(216, 216, 216, 0);
BRect viewSize = Bounds();
char sliderMinLabel[10];
char sliderMaxLabel[10];
char msg[100];
origPrintVal = printCurrVal; origPrintVal = printCurrVal;
origScreenVal = screenCurrVal; origScreenVal = screenCurrVal;
SetViewColor(216, 216, 216, 0);
rgb_color fillColor; rgb_color fillColor;
fillColor.red = 0; fillColor.red = 102;
fillColor.blue = 152; fillColor.blue = 203;
fillColor.green = 102; fillColor.green = 152;
viewSize.InsetBy(15, 10); float fontheight = FontHeight(true);
BRect rect(Bounds());
sprintf(msg, "Screen font cache size : %d kB", static_cast<int>(screenCurrVal)); rect.InsetBy(5.0, 3.0);
rect.top += fontheight;
screenFCS = new BSlider(*(new BRect(viewSize.left, viewSize.top, viewSize.right, viewSize.top + 25.0)), rect.bottom = rect.top +(fontheight *2.0);
"screenFontCache", BString labels(B_EMPTY_STRING);
msg, labels << "Screen" << kLabel << screenCurrVal << " kB";
screenFCS = new BSlider(rect,
"screenFontCache", labels.String(),
new BMessage(SCREEN_FCS_UPDATE_MSG), new BMessage(SCREEN_FCS_UPDATE_MSG),
minVal, minVal, maxVal, B_TRIANGLE_THUMB);
maxVal,
B_TRIANGLE_THUMB
);
screenFCS->SetModificationMessage(new BMessage(SCREEN_FCS_MODIFICATION_MSG)); screenFCS->SetModificationMessage(new BMessage(SCREEN_FCS_MODIFICATION_MSG));
sprintf(sliderMinLabel, "%d kB", minVal); BString minLabel(B_EMPTY_STRING);
sprintf(sliderMaxLabel, "%d kB", maxVal); BString maxLabel(B_EMPTY_STRING);
screenFCS->SetLimitLabels(sliderMinLabel, sliderMaxLabel); minLabel << minVal << " kB";
maxLabel << maxVal << " kB";
screenFCS->SetLimitLabels(minLabel.String(), maxLabel.String());
screenFCS->UseFillColor(TRUE, &fillColor); screenFCS->UseFillColor(TRUE, &fillColor);
screenFCS->SetValue(screenCurrVal); screenFCS->SetValue(screenCurrVal);
viewSize.top = viewSize.top + 65.0; rect.OffsetTo(rect.left, rect.bottom +(fontheight *2.5));
sprintf(msg, "Printing font cache size : %d kB", static_cast<int>(printCurrVal)); labels = "";
labels << "Printing " << kLabel << printCurrVal << " kB";
printFCS = new BSlider(*(new BRect(viewSize.left, viewSize.top, viewSize.right, viewSize.top + 25.0)), printFCS = new BSlider(rect, "printFontCache", labels.String(),
"printFontCache",
msg,
new BMessage(PRINT_FCS_UPDATE_MSG), new BMessage(PRINT_FCS_UPDATE_MSG),
minVal, minVal, maxVal, B_TRIANGLE_THUMB);
maxVal,
B_TRIANGLE_THUMB
);
printFCS->SetModificationMessage(new BMessage(PRINT_FCS_MODIFICATION_MSG)); printFCS->SetModificationMessage(new BMessage(PRINT_FCS_MODIFICATION_MSG));
printFCS->SetLimitLabels(sliderMinLabel, sliderMaxLabel); printFCS->SetLimitLabels(minLabel.String(), maxLabel.String());
printFCS->UseFillColor(TRUE, &fillColor); printFCS->UseFillColor(TRUE, &fillColor);
printFCS->SetValue(printCurrVal); printFCS->SetValue(printCurrVal);
viewSize.top = viewSize.top + 70.0; rect.OffsetTo(rect.left -1.0, rect.bottom +(fontheight *2.0));
rect.right = rect.left +86.0;
rect.bottom = rect.top +24.0;
BButton *saveCache = new BButton(*(new BRect(viewSize.left, viewSize.top, 100.0, 20.0)), BButton *saveCache = new BButton(rect,
"saveCache", "saveCache", "Save Cache",
"Save Cache", NULL, B_FOLLOW_LEFT, B_WILL_DRAW);
NULL,
B_FOLLOW_LEFT,
B_WILL_DRAW
);
AddChild(screenFCS); AddChild(screenFCS);
AddChild(printFCS); AddChild(printFCS);
AddChild(saveCache); AddChild(saveCache);
} }
/** /**
@@ -130,15 +125,13 @@ int CacheView::getScreenFCSValue(){
*/ */
void CacheView::revertToOriginal(){ void CacheView::revertToOriginal(){
char msg[100]; BString label;
label << "Screen " << kLabel << getScreenFCSValue();
updateScreenFCS(label.String());
screenFCS->SetValue(origScreenVal); label = "Printing ";
sprintf(msg, "Screen font cache size : %d kB", getScreenFCSValue()); label << kLabel << getPrintFCSValue();
updateScreenFCS(msg); updatePrintFCS(label.String());
printFCS->SetValue(origPrintVal);
sprintf(msg, "Printing font cache size : %d kB", getPrintFCSValue());
updatePrintFCS(msg);
}//revertToOriginal }//revertToOriginal
@@ -146,16 +139,13 @@ void CacheView::revertToOriginal(){
* Sets the sliders to their default values. * Sets the sliders to their default values.
*/ */
void CacheView::resetToDefaults(){ void CacheView::resetToDefaults(){
BString label;
label << "Screen " << kLabel << getScreenFCSValue() << " kB";
updateScreenFCS(label.String());
char msg[100]; label = "Printing ";
label << kLabel << getPrintFCSValue() << " kB";
screenFCS->SetValue((int32) 256); updatePrintFCS(label.String());
sprintf(msg, "Screen font cache size : %d kB", getScreenFCSValue());
updateScreenFCS(msg);
printFCS->SetValue((int32) 256);
sprintf(msg, "Printing font cache size : %d kB", getPrintFCSValue());
updatePrintFCS(msg);
}//revertToOriginal }//revertToOriginal
-6
View File
@@ -41,11 +41,6 @@
#include <Slider.h> #include <Slider.h>
#endif
#ifndef _STDIO_H
#include <stdio.h>
#endif #endif
#ifndef _BUTTON_H #ifndef _BUTTON_H
@@ -64,7 +59,6 @@
int getScreenFCSValue(); int getScreenFCSValue();
void revertToOriginal(); void revertToOriginal();
void resetToDefaults(); void resetToDefaults();
private: private:
/** /**
+46 -28
View File
@@ -9,6 +9,18 @@
#endif #endif
#include "Pref_Utils.h"
// should be changed to allow larger and smaller
#define minSizeIndex 7
#define maxSizeIndex 12
// constants for labels
const char *kPlainFont = "Plain font:";
const char *kBoldFont = "Bold font:";
const char *kFixedFont = "Fixed font:";
const char *kSize = "Size: ";
/** /**
* Constructor * Constructor
* @param rect The size of the view. * @param rect The size of the view.
@@ -19,24 +31,11 @@ FontSelectionView::FontSelectionView(BRect rect, const char *name, int type)
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW) : BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
{ {
BBox *testTextBox;
float x;
float y;
BRect viewSize = Bounds();
BMenuField *fontListField;
BMenuField *sizeListField;
x = viewSize.Width() / 37;
y = viewSize.Height() / 8;
minSizeIndex = 9;
maxSizeIndex = 12;
switch(type){ switch(type){
case PLAIN_FONT_SELECTION_VIEW: case PLAIN_FONT_SELECTION_VIEW:
sprintf(typeLabel, "Plain font"); sprintf(typeLabel, kPlainFont);
origFont = be_plain_font; origFont = be_plain_font;
workingFont = be_plain_font; workingFont = be_plain_font;
setSizeChangedMessage = PLAIN_SIZE_CHANGED_MSG; setSizeChangedMessage = PLAIN_SIZE_CHANGED_MSG;
@@ -51,7 +50,7 @@ FontSelectionView::FontSelectionView(BRect rect, const char *name, int type)
case BOLD_FONT_SELECTION_VIEW: case BOLD_FONT_SELECTION_VIEW:
sprintf(typeLabel, "Bold font"); sprintf(typeLabel, kBoldFont);
origFont = be_bold_font; origFont = be_bold_font;
workingFont = be_bold_font; workingFont = be_bold_font;
setSizeChangedMessage = BOLD_SIZE_CHANGED_MSG; setSizeChangedMessage = BOLD_SIZE_CHANGED_MSG;
@@ -66,7 +65,7 @@ FontSelectionView::FontSelectionView(BRect rect, const char *name, int type)
case FIXED_FONT_SELECTION_VIEW: case FIXED_FONT_SELECTION_VIEW:
sprintf(typeLabel, "Fixed font"); sprintf(typeLabel, kFixedFont);
origFont = be_fixed_font; origFont = be_fixed_font;
workingFont = be_fixed_font; workingFont = be_fixed_font;
setSizeChangedMessage = FIXED_SIZE_CHANGED_MSG; setSizeChangedMessage = FIXED_SIZE_CHANGED_MSG;
@@ -81,22 +80,41 @@ FontSelectionView::FontSelectionView(BRect rect, const char *name, int type)
}//switch }//switch
float fontheight = FontHeight(false);
float divider = StringWidth(kFixedFont);
sizeList = new BPopUpMenu("sizeList", true, true, B_ITEMS_IN_COLUMN); sizeList = new BPopUpMenu("sizeList", true, true, B_ITEMS_IN_COLUMN);
fontList = new BPopUpMenu("fontList", true, true, B_ITEMS_IN_COLUMN); fontList = new BPopUpMenu("fontList", true, true, B_ITEMS_IN_COLUMN);
fontListField = new BMenuField(*(new BRect(x, y, (25 * x), (3 * y))), "fontField", typeLabel, fontList);
fontListField->SetDivider(7 * x);
sizeListField = new BMenuField(*(new BRect((27 * x), y, (36 * x), (3 * y))), "fontField", "Size", sizeList);
sizeListField->SetDivider(31 * x);
testTextBox = new BBox(*(new BRect((8 * x), (5 * y), (36 * x), (8 * y))), "TestTextBox", B_FOLLOW_ALL, B_WILL_DRAW, B_FANCY_BORDER); // create menus
// size box
rect = Bounds();
float x = StringWidth("999") +16;
rect.left = rect.right -(x +StringWidth(kSize)+8.0);
rect.bottom = fontheight +5;
BMenuField *sizeListField = new BMenuField(rect, "fontField", kSize, sizeList, true);
sizeListField->SetDivider(StringWidth(kSize)+5.0);
sizeListField->SetAlignment(B_ALIGN_RIGHT);
// font menu
rect.right = rect.left;
rect.left = 1;
rect.bottom = fontheight *1.5;
BMenuField *fontListField = new BMenuField(rect, "fontField", typeLabel, fontList, false);
fontListField->SetDivider(divider +6.0);
fontListField->SetAlignment(B_ALIGN_RIGHT);
rect = Bounds();
rect.left = divider +8.0;
rect.top = fontheight *1.5 +4;
rect.InsetBy(1, 1);
BBox *testTextBox = new BBox(rect, "TestTextBox", B_FOLLOW_ALL, B_WILL_DRAW, B_FANCY_BORDER);
// Place the text slightly inside the entire box area, so it doesn't overlap the box outline. // Place the text slightly inside the entire box area, so it doesn't overlap the box outline.
BRect testTextRect(testTextBox->Bounds()); rect = testTextBox->Bounds().InsetByCopy(2, 2);
testTextRect.top = 2; rect.right -= 2;
testTextRect.left = 4; BRect testTextRect(rect);
testTextRect.bottom = testTextRect.bottom - 2; testText = new BStringView(testTextRect, "testText", "The quick brown fox jumps over the lazy dog.",
testTextRect.right = testTextRect.right - 4; B_FOLLOW_ALL, B_WILL_DRAW);
testText = new BStringView(testTextRect, "testText", "The quick brown fox jumped over the lazy dog.", B_FOLLOW_ALL, B_WILL_DRAW);
testText->SetFont(&workingFont); testText->SetFont(&workingFont);
fontList->SetLabelFromMarked(true); fontList->SetLabelFromMarked(true);
@@ -461,7 +479,7 @@ void FontSelectionView::UpdateFontSelection(BFont *fnt){
if(strcmp(sizeList->ItemAt(i)->Label(), size) == 0){ if(strcmp(sizeList->ItemAt(i)->Label(), size) == 0){
sizeList->ItemAt(i)->SetMarked(true); sizeList->ItemAt(i)->SetMarked(true);
break;
}//if }//if
}//for }//for
-1
View File
@@ -116,7 +116,6 @@
void emptyMenus(); void emptyMenus();
void resetToDefaults(); void resetToDefaults();
void revertToOriginal(); void revertToOriginal();
private: private:
/** /**
+21 -12
View File
@@ -9,6 +9,8 @@
#endif #endif
#include "Pref_Utils.h"
/** /**
* Constructor. * Constructor.
* @param rect The size of the view. * @param rect The size of the view.
@@ -16,19 +18,15 @@
FontView::FontView(BRect rect) FontView::FontView(BRect rect)
:BView(rect, "FontView", B_FOLLOW_ALL, B_WILL_DRAW) :BView(rect, "FontView", B_FOLLOW_ALL, B_WILL_DRAW)
{ {
BRect bounds(Bounds().InsetByCopy(5, 5));
float x; BRect rect(bounds);
float y; rect.bottom = rect.top +FontHeight(true) *3.5;
BRect viewSize = Bounds(); plainSelectionView = new FontSelectionView(rect, "Plain", PLAIN_FONT_SELECTION_VIEW);
rect.OffsetBy(0, rect.Height()+4);
SetViewColor(216, 216, 216, 0); boldSelectionView = new FontSelectionView(rect, "Bold", BOLD_FONT_SELECTION_VIEW);
rect.OffsetBy(0, rect.Height()+4);
x = viewSize.Width() / 39; fixedSelectionView = new FontSelectionView(rect, "Fixed", FIXED_FONT_SELECTION_VIEW);
y = viewSize.Height() / 25;
plainSelectionView = new FontSelectionView(*(new BRect(x, y, (38.0 * x), (8.0 * y))), "Plain", PLAIN_FONT_SELECTION_VIEW);
boldSelectionView = new FontSelectionView(*(new BRect(x, (9.0 * y), (38.0 * x), (16.0 * y))), "Bold", BOLD_FONT_SELECTION_VIEW);
fixedSelectionView = new FontSelectionView(*(new BRect(x, (17.0 * y), (38.0 * x), (24.0 * y))), "Fixed", FIXED_FONT_SELECTION_VIEW);
AddChild(plainSelectionView); AddChild(plainSelectionView);
AddChild(boldSelectionView); AddChild(boldSelectionView);
@@ -36,6 +34,17 @@ FontView::FontView(BRect rect)
} }
void
FontView::AttachedToWindow(void)
{
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(219, 219, 219, 255);
}
/** /**
* Calls each FontSelectionView's buildMenus() function to build the * Calls each FontSelectionView's buildMenus() function to build the
* font and size menus. * font and size menus.
+1 -2
View File
@@ -28,8 +28,8 @@
class FontView : public BView{ class FontView : public BView{
public: public:
FontView(BRect frame); FontView(BRect frame);
void AttachedToWindow(void);
FontSelectionView *plainSelectionView; FontSelectionView *plainSelectionView;
FontSelectionView *boldSelectionView; FontSelectionView *boldSelectionView;
FontSelectionView *fixedSelectionView; FontSelectionView *fixedSelectionView;
@@ -37,7 +37,6 @@
void emptyMenus(); void emptyMenus();
void resetToDefaults(); void resetToDefaults();
void revertToOriginal(); void revertToOriginal();
}; };
#endif #endif
+58
View File
@@ -0,0 +1,58 @@
/*
FontsSettings.cpp
*/
#include <Application.h>
#include <FindDirectory.h>
#include <File.h>
#include <Path.h>
#include <String.h>
#include <stdio.h>
#include "FontsSettings.h"
const char FontsSettings::kSettingsFile[] = "Font_Settings";
const BPoint kDEFAULT = BPoint(100, 100);
FontsSettings::FontsSettings()
{
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
path.Append(kSettingsFile);
BFile file(path.Path(), B_READ_ONLY);
if (file.InitCheck() == B_OK) {
float x, y;
if (file.Read(&x, sizeof(float)) != sizeof(float)) {
x = kDEFAULT.x;
}
if (file.Read(&y, sizeof(float)) != sizeof(float)) {
y = kDEFAULT.y;
}
f_corner = BPoint(x, y);
} else {
f_corner = kDEFAULT;
}
}
}
FontsSettings::~FontsSettings()
{
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK)
return;
path.Append(kSettingsFile);
BFile file(path.Path(), B_WRITE_ONLY|B_CREATE_FILE);
if (file.InitCheck() == B_OK) {
float x = f_corner.x;
float y = f_corner.y;
file.Write(&x, sizeof(float));
file.Write(&y, sizeof(float));
}
}
void
FontsSettings::SetWindowCorner(BPoint where)
{
f_corner = where;
}
+16
View File
@@ -0,0 +1,16 @@
#ifndef FONTS_SETTINGS_H
#define FONTS_SETTINGS_H
class FontsSettings {
public:
FontsSettings(void);
~FontsSettings(void);
BPoint WindowCorner(void) const { return f_corner; }
void SetWindowCorner(BPoint);
private:
static const char kSettingsFile[];
BPoint f_corner;
};
#endif //FONTS_SETTINGS_H
+9 -6
View File
@@ -22,18 +22,19 @@ MainWindow::MainWindow(BRect frame)
BTabView *tabView; BTabView *tabView;
BTab *tab; BTab *tab;
BBox *topLevelView; BBox *topLevelView;
double buttonViewHeight = 38.0; double buttonViewHeight = 43.0;
r = Bounds(); r = Bounds();
r.InsetBy(0, 10); r.top += 10;
r.bottom -= buttonViewHeight; r.bottom -= buttonViewHeight+1;
tabView = new BTabView(r, "tab_view", B_WIDTH_FROM_WIDEST); tabView = new BTabView(r, "tab_view", B_WIDTH_FROM_LABEL);
tabView->SetViewColor(216,216,216,0); tabView->SetViewColor(216,216,216,0);
r = tabView->Bounds(); r = tabView->Bounds();
r.InsetBy(5, 5); r.InsetBy(5, 5);
r.bottom -= tabView->TabHeight(); r.bottom -= tabView->TabHeight();
r.right -=2;
tab = new BTab(); tab = new BTab();
tabView->AddTab(fontPanel = new FontView(r), tab); tabView->AddTab(fontPanel = new FontView(r), tab);
tab->SetLabel(" Fonts "); tab->SetLabel(" Fonts ");
@@ -59,8 +60,10 @@ MainWindow::MainWindow(BRect frame)
*/ */
bool MainWindow::QuitRequested() bool MainWindow::QuitRequested()
{ {
be_app->PostMessage(B_QUIT_REQUESTED); BMessage *message = new BMessage(B_QUIT_REQUESTED);
return(true); message->AddPoint("corner", Frame().LeftTop());
be_app->PostMessage(message);
return true;
} }
/** /**
+30
View File
@@ -0,0 +1,30 @@
#include "Pref_Utils.h"
float
FontHeight(bool full, BView* target)
{
font_height finfo;
if (target != NULL)
target->GetFontHeight(&finfo);
else
be_plain_font->GetHeight(&finfo);
float height = ceil(finfo.ascent) + ceil(finfo.descent);
if (full)
height += ceil(finfo.leading);
return height;
}
color_map*
ColorMap()
{
color_map* cmap;
BScreen screen(B_MAIN_SCREEN_ID);
cmap = (color_map*)screen.ColorMap();
return cmap;
}
+10
View File
@@ -0,0 +1,10 @@
#ifndef SHARED_PREF_UTILS
#define SHARED_PREF_UTILS
#include <Screen.h>
#include <View.h>
float FontHeight(bool full, BView* view = NULL);
color_map* ColorMap();
#endif
Binary file not shown.
+31 -15
View File
@@ -14,6 +14,8 @@
#endif #endif
#include "FontsSettings.h"
/** /**
* Main method. * Main method.
* *
@@ -38,22 +40,36 @@ int main(int, char**){
* Provides a contstructor for the application. * Provides a contstructor for the application.
*/ */
Font_pref::Font_pref() Font_pref::Font_pref()
:BApplication("application/x-vnd.MSM-FontPrefPanel"){ :BApplication("application/x-vnd.Haiku-FNPL") {
/* f_settings = new FontsSettings();
* The main interface window.
*/
MainWindow *Main;
/*
* Sets the size for the main window.
*/
BRect MainWindowRect; BRect MainWindowRect;
MainWindowRect.Set(100, 80, 445, 343);
MainWindowRect.Set(100, 80, 450, 350); window = new MainWindow(MainWindowRect);
Main = new MainWindow(MainWindowRect); window->MoveTo(f_settings->WindowCorner());
Main->Show();
} }
Font_pref::~Font_pref()
{
delete f_settings;
}
bool
Font_pref::QuitRequested()
{
BMessage *message = CurrentMessage();
BPoint point;
if (message->FindPoint("corner", &point) == B_OK) {
f_settings->SetWindowCorner(point);
}
return BApplication::QuitRequested();
}
void
Font_pref::ReadyToRun()
{
window->Show();
}
+8 -1
View File
@@ -13,6 +13,8 @@
#endif #endif
class FontsSettings;
class MainWindow;
/** /**
* Main class. * Main class.
* *
@@ -26,7 +28,12 @@
* Constructor. * Constructor.
*/ */
Font_pref(); Font_pref();
~Font_pref();
void ReadyToRun();
bool QuitRequested();
private:
FontsSettings *f_settings;
MainWindow *window;
}; };
#endif #endif