* Constructor */
| 56 | * Constructor |
| 57 | */ |
| 58 | CsvApplication::CsvApplication() { |
| 59 | std::string prefTheme = getPreference(&preferences, TCRUNCHER_PREF_THEME, "Bright"); |
| 60 | std::string prefFont = getPreference(&preferences, TCRUNCHER_PREF_GRID_TEXT_FONT, TCRUNCHER_FALLBACK_FONT); |
| 61 | |
| 62 | struct My_Fl_Button::buttonColorStruct colorsDefaultButton; |
| 63 | colorsDefaultButton.background = ColorThemes::getColor(prefTheme, "button_bg"); |
| 64 | colorsDefaultButton.label = ColorThemes::getColor(prefTheme, "button_text"); |
| 65 | colorsDefaultButton.border = ColorThemes::getColor(prefTheme, "button_border"); |
| 66 | colorsDefaultButton.windowBg = ColorThemes::getColor(prefTheme, "win_bg"); |
| 67 | colorsDefaultButton.borderWidth = ColorThemes::getColor(prefTheme, "button_border_width"); |
| 68 | struct My_Fl_Button::buttonColorStruct colorsHighlightButton; |
| 69 | colorsHighlightButton.background = ColorThemes::getColor(prefTheme, "hightlight_button_bg"); |
| 70 | colorsHighlightButton.label = ColorThemes::getColor(prefTheme, "hightlight_button_text"); |
| 71 | colorsHighlightButton.border = ColorThemes::getColor(prefTheme, "hightlight_button_border"); |
| 72 | colorsHighlightButton.windowBg = ColorThemes::getColor(prefTheme, "win_bg"); |
| 73 | colorsHighlightButton.borderWidth = ColorThemes::getColor(prefTheme, "highlight_button_border_width"); |
| 74 | |
| 75 | // Improve tooltip layout |
| 76 | Fl_Tooltip::textcolor( ColorThemes::getColor(prefTheme, "header_row_text") ); |
| 77 | Fl_Tooltip::color( ColorThemes::getColor(prefTheme, "win_bg") ); |
| 78 | Fl_Tooltip::delay( 0.2 ); |
| 79 | Fl_Tooltip::size( 12 ); |
| 80 | Fl_Tooltip::margin_width(6); // default: 3 |
| 81 | Fl_Tooltip::margin_height(4); // default: 3 |
| 82 | |
| 83 | |
| 84 | // Grid fonts |
| 85 | #ifdef __APPLE__ |
| 86 | const char* TCRUNCHER_FONTS_ARR[] = {"Andale Mono", "Courier New", "Helvetica", "Menlo", "Monaco"}; |
| 87 | const int TCRUNCHER_FONTS_ARR_COUNT = 5; |
| 88 | #else |
| 89 | const char* TCRUNCHER_FONTS_ARR[] = {"Consolas", "Courier New", "Helvetica"}; |
| 90 | const int TCRUNCHER_FONTS_ARR_COUNT = 3; |
| 91 | #endif |
| 92 | |
| 93 | // Fl::set_font(9901, "Monaco"); |
| 94 | for( int i = 0; i < TCRUNCHER_FONTS_ARR_COUNT; ++i ) { |
| 95 | Fl::set_font(TCRUNCHER_FONT_NUMBER + i, TCRUNCHER_FONTS_ARR[i]); |
| 96 | fontMapping[std::string(TCRUNCHER_FONTS_ARR[i])] = TCRUNCHER_FONT_NUMBER + i; |
| 97 | } |
| 98 | |
| 99 | // |
| 100 | // Create Search Window |
| 101 | searchWin = new My_Fl_Search_Window(600,350); |
| 102 | searchWin->label("Find and Replace"); |
| 103 | searchWin->color(ColorThemes::getColor(prefTheme, "win_bg")); |
| 104 | searchInput = new Fl_Input(120,20,370,20, "Find:"); |
| 105 | searchInput->box(FL_BORDER_BOX); |
| 106 | searchInput->labelcolor(ColorThemes::getColor(prefTheme, "win_text")); |
| 107 | replaceInput = new Fl_Input(120,70,370,20, "Replace:"); |
| 108 | replaceInput->box(FL_BORDER_BOX); |
| 109 | replaceInput->labelcolor(ColorThemes::getColor(prefTheme, "win_text")); |
| 110 | findButton = new My_Fl_Button(120,210,100,24, "Find Next"); |
| 111 | findButton->colors = colorsHighlightButton; |
| 112 | findButton->callback(find_substring_CB, TCRUNCHER_MYFLCHOICE_MAGICAL); |
| 113 | findButton->shortcut(FL_Enter); |
| 114 | replaceButton = new My_Fl_Button(120,250,100,24, "Replace"); |
| 115 | replaceButton->colors = colorsDefaultButton; |
nothing calls this directly
no test coverage detected