1 /* PoorManLoggingView.cpp 2 * 3 * Philip Harrison 4 * Started: 5/12/2004 5 * Version: 0.1 6 */ 7 8 #include <Box.h> 9 #include <Catalog.h> 10 #include <Locale.h> 11 12 #include "constants.h" 13 #include "PoorManWindow.h" 14 #include "PoorManApplication.h" 15 #include "PoorManLoggingView.h" 16 17 18 #undef B_TRANSLATION_CONTEXT 19 #define B_TRANSLATION_CONTEXT "PoorMan" 20 21 22 PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name) 23 : BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW) 24 { 25 PoorManWindow * win; 26 win = ((PoorManApplication *)be_app)->GetPoorManWindow(); 27 28 SetViewColor(BACKGROUND_COLOR); 29 30 // Console Logging BBox 31 BRect consoleLoggingRect; 32 consoleLoggingRect = rect; 33 consoleLoggingRect.top -= 5.0; 34 consoleLoggingRect.left -= 5.0; 35 consoleLoggingRect.right -= 7.0; 36 consoleLoggingRect.bottom -= 118.0; 37 38 BBox * consoleLogging = new BBox(consoleLoggingRect, 39 B_TRANSLATE("Console Logging")); 40 consoleLogging->SetLabel(STR_BBX_CONSOLE_LOGGING); 41 AddChild(consoleLogging); 42 43 44 // File Logging BBox 45 BRect fileLoggingRect; 46 fileLoggingRect = consoleLoggingRect; 47 fileLoggingRect.top = consoleLoggingRect.bottom + 10.0; 48 fileLoggingRect.bottom = fileLoggingRect.top + 100.0; 49 50 BBox * fileLogging = new BBox(fileLoggingRect, 51 B_TRANSLATE("File Logging")); 52 fileLogging->SetLabel(STR_BBX_FILE_LOGGING); 53 AddChild(fileLogging); 54 55 float left = 10.0; 56 float top = 20.0; 57 float box_size = 13.0; 58 BRect tempRect(left, top, consoleLoggingRect.Width() - 5.0, top + box_size); 59 60 // Console Logging 61 logConsole = new BCheckBox(tempRect, B_TRANSLATE("Log To Console"), 62 STR_CBX_LOG_CONSOLE, new BMessage(MSG_PREF_LOG_CBX_CONSOLE)); 63 // set the checkbox to the value the program has 64 SetLogConsoleValue(win->LogConsoleFlag()); 65 consoleLogging->AddChild(logConsole); 66 67 // File Logging 68 logFile = new BCheckBox(tempRect, B_TRANSLATE("Log To File"), 69 STR_CBX_LOG_FILE, new BMessage(MSG_PREF_LOG_CBX_FILE)); 70 // set the checkbox to the value the program has 71 SetLogFileValue(win->LogFileFlag()); 72 fileLogging->AddChild(logFile); 73 74 // File Name 75 tempRect.top = tempRect.bottom + 10.0; 76 tempRect.bottom = tempRect.top + box_size; 77 tempRect.right -= 5.0; 78 79 logFileName = new BTextControl(tempRect, B_TRANSLATE("File Name"), 80 STR_TXT_LOG_FILE_NAME, NULL, NULL); 81 logFileName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); 82 logFileName->SetDivider(fileLogging->StringWidth(STR_TXT_LOG_FILE_NAME) + 8.0f); 83 SetLogFileName(win->LogPath()); 84 fileLogging->AddChild(logFileName); 85 86 // Create Log File 87 BRect createLogFileRect; 88 createLogFileRect.top = tempRect.bottom + 13.0; 89 createLogFileRect.right = tempRect.right + 2.0; 90 createLogFileRect.left = createLogFileRect.right 91 - fileLogging->StringWidth(B_TRANSLATE("Create Log File")) - 24.0; 92 createLogFileRect.bottom = createLogFileRect.top + 19.0; 93 94 createLogFile = new BButton(createLogFileRect, B_TRANSLATE("Create Log File"), 95 STR_BTN_CREATE_LOG_FILE, new BMessage(MSG_PREF_LOG_BTN_CREATE_FILE)); 96 fileLogging->AddChild(createLogFile); 97 98 } 99