Ticket #7536: FontDemo.patch

File FontDemo.patch, 6.5 KB (added by taos, 8 years ago)

Obsolete

  • src/apps/fontdemo/Jamfile

     
    66    ControlView.cpp
    77    FontDemo.cpp
    88    FontDemoView.cpp
    9     : be $(TARGET_LIBSUPC++)
     9    : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
    1010    : FontDemo.rdef
    1111    ;
     12
     13DoCatalogs FontDemo :
     14    x-vnd.Haiku-FontDemo
     15    :
     16    FontDemo.cpp
     17    ControlView.cpp
     18;
  • src/apps/fontdemo/ControlView.cpp

     
    1111#include "messages.h"
    1212
    1313#include <Button.h>
     14#include <Catalog.h>
    1415#include <CheckBox.h>
    1516#include <Menu.h>
    1617#include <MenuField.h>
     
    2425
    2526#include <stdio.h>
    2627
     28#undef B_TRANSLATE_CONTEXT
     29#define B_TRANSLATE_CONTEXT "ControlView"
    2730
    2831ControlView::ControlView(BRect rect)
    2932    : BView(rect, "ControlView", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE_JUMP),
     
    6669    float offsetX = 0;
    6770    float offsetY = 0;
    6871
    69     fTextControl = new BTextControl(rect, "TextInput", "Text:", "Haiku, Inc.", NULL);
     72    fTextControl = new BTextControl(rect, "TextInput", B_TRANSLATE("Text:"),
     73        "Haiku, Inc.", NULL);
    7074    fTextControl->SetDivider(29.0);
    7175    fTextControl->SetModificationMessage(new BMessage(TEXT_CHANGED_MSG));
    7276    AddChild(fTextControl);
     
    7579    _AddFontMenu(rect);
    7680
    7781    rect.OffsetBy(0.0, 29.0);
    78     fFontsizeSlider = new BSlider(rect, "Fontsize", "Size: 50", NULL, 4, 360);
     82    fFontsizeSlider = new BSlider(rect, "Fontsize", B_TRANSLATE("Size: 50"),
     83        NULL, 4, 360);
    7984    fFontsizeSlider->SetModificationMessage(new BMessage(FONTSIZE_MSG));
    8085    fFontsizeSlider->SetValue(50);
    8186    AddChild(fFontsizeSlider);
     
    8590    offsetX += 1;
    8691
    8792    rect.OffsetBy(0.0, offsetX);
    88     fShearSlider = new BSlider(rect, "Shear", "Shear: 90", NULL, 45, 135);
     93    fShearSlider = new BSlider(rect, "Shear", B_TRANSLATE("Shear: 90"),
     94        NULL, 45, 135);
    8995    fShearSlider->SetModificationMessage(new BMessage(FONTSHEAR_MSG));
    9096    fShearSlider->SetValue(90);
    9197    AddChild(fShearSlider);
    9298
    9399    rect.OffsetBy(0.0, offsetX);
    94     fRotationSlider = new BSlider(rect, "Rotation", "Rotation: 0", NULL, 0, 360);
     100    fRotationSlider = new BSlider(rect, "Rotation", B_TRANSLATE("Rotation: 0"),
     101        NULL, 0, 360);
    95102    fRotationSlider->SetModificationMessage( new BMessage(ROTATION_MSG));
    96103    fRotationSlider->SetValue(0);
    97104    AddChild(fRotationSlider);
    98105
    99106    rect.OffsetBy(0.0, offsetX);
    100     fSpacingSlider = new BSlider(rect, "Spacing", "Spacing: 0", NULL, -5, 50);
     107    fSpacingSlider = new BSlider(rect, "Spacing", B_TRANSLATE("Spacing: 0"),
     108        NULL, -5, 50);
    101109    fSpacingSlider->SetModificationMessage(new BMessage(SPACING_MSG));
    102110    fSpacingSlider->SetValue(0);
    103111    AddChild(fSpacingSlider);
    104112
    105113    rect.OffsetBy(0.0, offsetX);
    106     fOutlineSlider = new BSlider(rect, "Outline", "Outline:", NULL, 0, 20);
     114    fOutlineSlider = new BSlider(rect, "Outline", B_TRANSLATE("Outline:"),
     115        NULL, 0, 20);
    107116    fOutlineSlider->SetModificationMessage(new BMessage(OUTLINE_MSG));
    108117    AddChild(fOutlineSlider);
    109118
    110119    rect.OffsetBy(0.0, offsetX);
    111     fAliasingCheckBox = new BCheckBox(rect, "Aliasing", "Antialiased text",
    112         new BMessage(ALIASING_MSG));
     120    fAliasingCheckBox = new BCheckBox(rect, "Aliasing",
     121        B_TRANSLATE("Antialiased text"), new BMessage(ALIASING_MSG));
    113122    fAliasingCheckBox->SetValue(B_CONTROL_ON);
    114123    AddChild(fAliasingCheckBox);
    115124
     
    154163
    155164    fDrawingModeMenu->SetLabelFromMarked(true);
    156165
    157     BMenuField *drawingModeMenuField = new BMenuField(rect, "FontMenuField", "Drawing mode:", fDrawingModeMenu, true);
     166    BMenuField *drawingModeMenuField = new BMenuField(rect, "FontMenuField",
     167        B_TRANSLATE("Drawing mode:"), fDrawingModeMenu, true);
    158168    drawingModeMenuField->SetDivider(5+StringWidth("Drawing mode:"));
    159169    AddChild(drawingModeMenuField);
    160170
    161171    rect.OffsetBy(0.0, 22);
    162     fBoundingboxesCheckBox = new BCheckBox(rect, "BoundingBoxes", "Bounding boxes",
    163         new BMessage(BOUNDING_BOX_MSG));
     172    fBoundingboxesCheckBox = new BCheckBox(rect, "BoundingBoxes",
     173        B_TRANSLATE("Bounding boxes"), new BMessage(BOUNDING_BOX_MSG));
    164174    AddChild(fBoundingboxesCheckBox);
    165175
    166176    rect.OffsetBy(0.0, 22.0);
    167     fCyclingFontButton = new BButton(rect, "Cyclefonts", "Cycle fonts",
    168         new BMessage(CYCLING_FONTS_MSG));
     177    fCyclingFontButton = new BButton(rect, "Cyclefonts",
     178        B_TRANSLATE("Cycle fonts"), new BMessage(CYCLING_FONTS_MSG));
    169179    AddChild(fCyclingFontButton);
    170180
    171181    fTextControl->SetTarget(this);
     
    310320
    311321        case CYCLING_FONTS_MSG:
    312322        {
    313             fCyclingFontButton->SetLabel(fCycleFonts ? "Cycle fonts" : "Stop cycling");
     323            fCyclingFontButton->SetLabel(fCycleFonts ?
     324                B_TRANSLATE("Cycle fonts") : B_TRANSLATE("Stop cycling"));
    314325            fCycleFonts = !fCycleFonts;
    315326
    316327            if (fCycleFonts) {
     
    456467
    457468    _UpdateFontmenus(true);
    458469
    459     fFontMenuField = new BMenuField(rect, "FontMenuField", "Font:", fFontFamilyMenu, true);
     470    fFontMenuField = new BMenuField(rect, "FontMenuField", B_TRANSLATE("Font:"),
     471        fFontFamilyMenu, true);
    460472    fFontMenuField->SetDivider(30.0);
    461473    AddChild(fFontMenuField);
    462474}
  • src/apps/fontdemo/FontDemo.cpp

     
    1212#include "ControlView.h"
    1313
    1414#include <Window.h>
     15#include <Catalog.h>
    1516
     17#undef B_TRANSLATE_CONTEXT
     18#define B_TRANSLATE_CONTEXT "FontDemo"
    1619
    1720FontDemo::FontDemo()
    1821    : BApplication("application/x-vnd.Haiku-FontDemo")
    1922{
    2023    // Create the demo window where we draw the string
    21     BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300), "FontDemo",
    22         B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
     24    BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300),
     25        B_TRANSLATE_SYSTEM_NAME("FontDemo"), B_TITLED_WINDOW,
     26        B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
    2327
    2428    FontDemoView* demoView = new FontDemoView(demoWindow->Bounds());
    2529    demoWindow->AddChild(demoView);
    2630
    27     BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402), "Controls",
    28         B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL,
    29         B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS);
     31    BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402),
     32        B_TRANSLATE("Controls"), B_FLOATING_WINDOW_LOOK,
     33        B_FLOATING_APP_WINDOW_FEEL, B_NOT_CLOSABLE | B_NOT_ZOOMABLE |
     34        B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS);
    3035
    3136    ControlView* controlView = new ControlView(controlWindow->Bounds());
    3237    controlWindow->AddChild(controlView);