Merge branch 'main' into jump-curve

This commit is contained in:
Kevin Koenig
2021-09-04 07:52:42 -04:00
committed by GitHub
17 changed files with 288 additions and 102 deletions
+3 -3
View File
@@ -504,15 +504,15 @@ void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFla
}
}
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags)
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, const char * str, LcdFlags flags)
{
coord_t x = left;
coord_t y = top;
coord_t line = getFontHeight(flags & 0xFFFF);
coord_t space = getTextWidth(" ", 1, flags);
coord_t word;
char * eos = str + strlen(str);
char * nxt;
const char * eos = str + strlen(str);
const char * nxt;
while (str < eos) {
nxt = strstr(str, " ");
+1 -1
View File
@@ -72,7 +72,7 @@ void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude,
void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags = 0);
void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags = 0);
void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags = 0);
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags);
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, const char * str, LcdFlags flags);
inline void drawChn(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t idx, LcdFlags flags)
{
drawSource(dc, x, y, MIXSRC_CH1 + idx - 1, flags);
+5 -2
View File
@@ -26,6 +26,7 @@
#include "model_inputs.h"
#include "gvar_numberedit.h"
#include "model_curves.h"
#include "dataconstants.h"
#define SET_DIRTY() storageDirty(EE_MODEL)
@@ -383,7 +384,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
int mixIndex = 0;
MixData * mix = g_model.mixData;
for (uint8_t ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) {
if (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) {
if (mixIndex < MAX_MIXERS && mix->destCh == ch) {
coord_t h = grid.getWindowHeight();
auto txt = new MixLineTitle(window, grid.getLabelSlot(),
@@ -391,7 +392,9 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
uint8_t count = 0;
while (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) {
while (mixIndex < MAX_MIXERS && mix->destCh == ch) {
// First mix cannot be empty
if(!mixIndex && !mix->srcRaw) break;
Button * button = new MixLineButton(window, grid.getFieldSlot(), mixIndex);
button->setPressHandler([=]() -> uint8_t {
button->bringToTop();
+84 -3
View File
@@ -592,6 +592,9 @@ class TrainerModuleWindow : public FormGroup {
new Choice(this, grid.getFieldSlot(3, 2), STR_PPM_POL, 0, 1, GET_SET_DEFAULT(g_model.trainerData.pulsePol ));
grid.nextLine();
}
#if defined(PCBNV14)
new StaticText(this, grid.getLabelSlot(true) );
#endif
getParent()->moveWindowsTop(top() + 1, adjustHeight());
}
@@ -1432,8 +1435,89 @@ void ModelSetupPage::build(FormWindow * window)
}
}
grid.addWindow(group);
// Pots and sliders warning
#if NUM_POTS + NUM_SLIDERS
{
new StaticText(window, grid.getLabelSlot(true), STR_POTWARNINGSTATE);
new Choice(window, grid.getFieldSlot(), {"OFF", "ON", "AUTO"}, 0, 2,
GET_SET_DEFAULT(g_model.potsWarnMode));
grid.nextLine();
#if (NUM_POTS)
{
new StaticText(window, grid.getLabelSlot(true), STR_POTWARNING);
auto group =
new FormGroup(window, grid.getFieldSlot(),
FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout centerGrid(group);
for (int i = POT_FIRST, j = 0; i <= POT_LAST; i++) {
char s[8];
if ((IS_POT(i) || IS_POT_MULTIPOS(i))) {
if (j > 0 && ((j % 4) == 0)) centerGrid.nextLine();
auto button = new TextButton(
group, centerGrid.getSlot(4, j % 4),
getStringAtIndex(s, STR_VSRCRAW, i + 1), nullptr,
OPAQUE | ((g_model.potsWarnEnabled & (1 << j)) ? BUTTON_CHECKED
: 0));
button->setPressHandler([button, j] {
g_model.potsWarnEnabled ^= (1 << j);
if ((g_model.potsWarnMode == POTS_WARN_MANUAL) &&
(g_model.potsWarnEnabled & (1 << j))) {
SAVE_POT_POSITION(j);
}
button->check(g_model.potsWarnEnabled & (1 << j));
SET_DIRTY();
return (g_model.potsWarnEnabled & (1 << j));
});
j++;
}
}
grid.addWindow(group);
}
#endif
#if (NUM_SLIDERS)
{
new StaticText(window, grid.getLabelSlot(true), STR_SLIDERWARNING);
auto group =
new FormGroup(window, grid.getFieldSlot(),
FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout centerGrid(group);
for (int i = SLIDER_FIRST, j = 0; i <= SLIDER_LAST; i++) {
char s[8];
if ((IS_SLIDER(i))) {
if (j > 0 && ((j % 4) == 0)) centerGrid.nextLine();
auto *button = new TextButton(
group, centerGrid.getSlot(4, j % 4),
getStringAtIndex(s, STR_VSRCRAW, i + 1), nullptr,
OPAQUE | ((g_model.potsWarnEnabled & (1 << (j + NUM_POTS)))
? BUTTON_CHECKED
: 0));
button->setPressHandler([button, j] {
g_model.potsWarnEnabled ^= (1 << (j + NUM_POTS));
if ((g_model.potsWarnMode == POTS_WARN_MANUAL) &&
(g_model.potsWarnEnabled & (1 << (j + NUM_POTS)))) {
SAVE_POT_POSITION(j + NUM_POTS);
}
button->check(g_model.potsWarnEnabled & (1 << (j + NUM_POTS)));
SET_DIRTY();
return (g_model.potsWarnEnabled & (1 << (j + NUM_POTS)));
});
j++;
}
}
grid.addWindow(group);
}
#endif
}
#endif
}
grid.nextLine();
// Center beeps
{
new StaticText(window, grid.getLabelSlot(false), STR_BEEPCTR, 0, COLOR_THEME_PRIMARY1);
@@ -1484,9 +1568,6 @@ void ModelSetupPage::build(FormWindow * window)
grid.addWindow(new TrainerModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
}
#if defined(PCBNV14)
grid.nextLine();
#endif
window->setInnerHeight(grid.getWindowHeight());
}
@@ -42,7 +42,7 @@ bool SwitchWarnDialog::warningInactive()
if (!IS_POT_SLIDER_AVAILABLE(POT1 + i)) {
continue;
}
if (!(g_model.potsWarnEnabled & (1 << i)) && (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1)) {
if ( (g_model.potsWarnEnabled & (1 << i)) && (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1)) {
warn = true;
bad_pots |= (1 << i);
}
@@ -80,11 +80,11 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc)
unsigned int state = ((g_model.switchWarningState >> (3 * i)) & 0x07);
if (state && state - 1 != ((switches_states >> (i * 2)) & 0x03)) {
if (y < LCD_H) {
x = drawSwitch(dc, x, y, SWSRC_FIRST_SWITCH + i * 3 + state - 1, FONT(BOLD));
x = drawSwitch(dc, x, y, SWSRC_FIRST_SWITCH + i * 3 + state - 1, COLOR_THEME_PRIMARY1 | FONT(BOLD));
x += 5;
}
else {
dc->drawText(x, y, "...", FONT(BOLD));
dc->drawText(x, y, "...", COLOR_THEME_PRIMARY1 | FONT(BOLD));
break;
}
}
@@ -92,22 +92,24 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc)
}
if (g_model.potsWarnMode) {
x = ALERT_MESSAGE_LEFT;
y += 20;
for (int i = 0; i < NUM_POTS + NUM_SLIDERS; i++) {
if (!IS_POT_SLIDER_AVAILABLE(POT1 + i)) {
continue;
}
if (!(g_model.potsWarnEnabled & (1 << i))) {
if ( (g_model.potsWarnEnabled & (1 << i))) {
if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) {
if (y < LCD_H) {
char s[8];
// TODO add an helper
strncpy(s, &STR_VSRCRAW[1 + (NUM_STICKS + 1 + i) * STR_VSRCRAW[0]], STR_VSRCRAW[0]);
s[int(STR_VSRCRAW[0])] = '\0';
dc->drawText(x, y, s, COLOR_THEME_WARNING | FONT(XL));
y += 35;
dc->drawText(x, y, s, COLOR_THEME_PRIMARY1 | FONT(BOLD));
x += 40;
}
else {
dc->drawText(x, y, "...", COLOR_THEME_WARNING | FONT(XL));
dc->drawText(x, y, "...", COLOR_THEME_PRIMARY1 | FONT(BOLD));
}
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ class OpenTxTheme: public Theme
void init() const;
virtual void update() const
virtual void update(bool reload = true) const
{
}
+77 -69
View File
@@ -57,85 +57,92 @@ class Theme480: public OpenTxTheme
lcdColorTable[CUSTOM_COLOR_INDEX] = RGB(170, 85, 0);
}
void loadMenuIcon(uint8_t index, const uint8_t * lbm) const
void loadMenuIcon(uint8_t index, const uint8_t * lbm, bool reload) const
{
BitmapBuffer * mask = BitmapBuffer::load8bitMask(lbm);
if (mask) {
delete iconMask[index];
iconMask[index] = mask;
BitmapBuffer * mask;
if (reload) {
mask = BitmapBuffer::load8bitMask(lbm);
if (mask) {
delete iconMask[index];
iconMask[index] = mask;
delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconNormal[index]) {
menuIconNormal[index]->clear(COLOR_THEME_SECONDARY1);
menuIconNormal[index]->drawMask(0, 0, mask, COLOR_THEME_PRIMARY2);
}
delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
delete menuIconSelected[index];
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconSelected[index]) {
menuIconSelected[index]->clear(COLOR_THEME_FOCUS);
menuIconSelected[index]->drawMask(0, 0, mask, COLOR_THEME_PRIMARY2);
delete menuIconSelected[index];
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
}
} else
mask = iconMask[index];
if (menuIconNormal[index]) {
menuIconNormal[index]->clear(COLOR_THEME_SECONDARY1);
menuIconNormal[index]->drawMask(0, 0, mask, COLOR_THEME_PRIMARY2);
}
if (menuIconSelected[index]) {
menuIconSelected[index]->clear(COLOR_THEME_FOCUS);
menuIconSelected[index]->drawMask(0, 0, mask, COLOR_THEME_PRIMARY2);
}
}
void loadIcons() const
void loadIcons(bool reload) const
{
#if defined(LOG_TELEMETRY) || !defined(WATCHDOG)
loadMenuIcon(ICON_OPENTX, mask_opentx_testmode);
loadMenuIcon(ICON_OPENTX, mask_opentx_testmode, reload);
#else
loadMenuIcon(ICON_OPENTX, mask_edgetx);
loadMenuIcon(ICON_OPENTX, mask_edgetx, reload);
#endif
#if defined(HARDWARE_TOUCH) //TODO: get rid of, and use a real hitbox instead...
loadMenuIcon(ICON_NEXT, mask_next);
loadMenuIcon(ICON_BACK, mask_back);
loadMenuIcon(ICON_NEXT, mask_next, reload);
loadMenuIcon(ICON_BACK, mask_back, reload);
#endif
loadMenuIcon(ICON_RADIO, mask_menu_radio);
loadMenuIcon(ICON_RADIO_SETUP, mask_radio_setup);
loadMenuIcon(ICON_RADIO_SD_MANAGER, mask_radio_sd_browser);
loadMenuIcon(ICON_RADIO_TOOLS, mask_radio_tools);
//loadMenuIcon(ICON_RADIO_SPECTRUM_ANALYSER, mask_radio_spectrum_analyser);
loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, mask_radio_global_functions);
loadMenuIcon(ICON_RADIO_TRAINER, mask_radio_trainer);
loadMenuIcon(ICON_RADIO_HARDWARE, mask_radio_hardware);
loadMenuIcon(ICON_RADIO_CALIBRATION, mask_radio_calibration);
loadMenuIcon(ICON_RADIO_VERSION, mask_radio_version);
loadMenuIcon(ICON_MODEL, mask_menu_model);
loadMenuIcon(ICON_MODEL_SETUP, mask_model_setup);
loadMenuIcon(ICON_MODEL_HELI, mask_model_heli);
loadMenuIcon(ICON_MODEL_FLIGHT_MODES, mask_model_flight_modes);
loadMenuIcon(ICON_MODEL_INPUTS, mask_model_inputs);
loadMenuIcon(ICON_MODEL_MIXER, mask_model_mixer);
loadMenuIcon(ICON_MODEL_NOTES, mask_menu_notes);
loadMenuIcon(ICON_MODEL_OUTPUTS, mask_model_outputs);
loadMenuIcon(ICON_MODEL_CURVES, mask_model_curves);
loadMenuIcon(ICON_MODEL_GVARS, mask_model_gvars);
loadMenuIcon(ICON_MODEL_LOGICAL_SWITCHES, mask_model_logical_switches);
loadMenuIcon(ICON_MODEL_SPECIAL_FUNCTIONS, mask_model_special_functions);
loadMenuIcon(ICON_MODEL_LUA_SCRIPTS, mask_model_lua_scripts);
loadMenuIcon(ICON_MODEL_TELEMETRY, mask_model_telemetry);
loadMenuIcon(ICON_MODEL_SELECT, mask_menu_model_select);
loadMenuIcon(ICON_MODEL_SELECT_CATEGORY, mask_model_select_category);
loadMenuIcon(ICON_STATS, mask_menu_stats);
loadMenuIcon(ICON_STATS_THROTTLE_GRAPH, mask_stats_throttle_graph);
loadMenuIcon(ICON_STATS_TIMERS, mask_stats_timers);
loadMenuIcon(ICON_STATS_ANALOGS, mask_stats_analogs);
loadMenuIcon(ICON_STATS_DEBUG, mask_stats_debug);
loadMenuIcon(ICON_THEME, mask_menu_theme);
loadMenuIcon(ICON_THEME_SETUP, mask_theme_setup);
loadMenuIcon(ICON_THEME_VIEW1, mask_theme_view1);
loadMenuIcon(ICON_THEME_VIEW2, mask_theme_view2);
loadMenuIcon(ICON_THEME_VIEW3, mask_theme_view3);
loadMenuIcon(ICON_THEME_VIEW4, mask_theme_view4);
loadMenuIcon(ICON_THEME_VIEW5, mask_theme_view5);
loadMenuIcon(ICON_THEME_ADD_VIEW, mask_theme_add_view);
loadMenuIcon(ICON_MONITOR, mask_monitor);
loadMenuIcon(ICON_MONITOR_CHANNELS1, mask_monitor_channels1);
loadMenuIcon(ICON_MONITOR_CHANNELS2, mask_monitor_channels2);
loadMenuIcon(ICON_MONITOR_CHANNELS3, mask_monitor_channels3);
loadMenuIcon(ICON_MONITOR_CHANNELS4, mask_monitor_channels4);
loadMenuIcon(ICON_MONITOR_LOGICAL_SWITCHES, mask_monitor_logsw);
loadMenuIcon(ICON_RADIO, mask_menu_radio, reload);
loadMenuIcon(ICON_RADIO_SETUP, mask_radio_setup, reload);
loadMenuIcon(ICON_RADIO_SD_MANAGER, mask_radio_sd_browser, reload);
loadMenuIcon(ICON_RADIO_TOOLS, mask_radio_tools, reload);
//loadMenuIcon(ICON_RADIO_SPECTRUM_ANALYSER, mask_radio_spectrum_analyser, reload);
loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, mask_radio_global_functions, reload);
loadMenuIcon(ICON_RADIO_TRAINER, mask_radio_trainer, reload);
loadMenuIcon(ICON_RADIO_HARDWARE, mask_radio_hardware, reload);
loadMenuIcon(ICON_RADIO_CALIBRATION, mask_radio_calibration, reload);
loadMenuIcon(ICON_RADIO_VERSION, mask_radio_version, reload);
loadMenuIcon(ICON_MODEL, mask_menu_model, reload);
loadMenuIcon(ICON_MODEL_SETUP, mask_model_setup, reload);
loadMenuIcon(ICON_MODEL_HELI, mask_model_heli, reload);
loadMenuIcon(ICON_MODEL_FLIGHT_MODES, mask_model_flight_modes, reload);
loadMenuIcon(ICON_MODEL_INPUTS, mask_model_inputs, reload);
loadMenuIcon(ICON_MODEL_MIXER, mask_model_mixer, reload);
loadMenuIcon(ICON_MODEL_NOTES, mask_menu_notes, reload);
loadMenuIcon(ICON_MODEL_OUTPUTS, mask_model_outputs, reload);
loadMenuIcon(ICON_MODEL_CURVES, mask_model_curves, reload);
loadMenuIcon(ICON_MODEL_GVARS, mask_model_gvars, reload);
loadMenuIcon(ICON_MODEL_LOGICAL_SWITCHES, mask_model_logical_switches, reload);
loadMenuIcon(ICON_MODEL_SPECIAL_FUNCTIONS, mask_model_special_functions, reload);
loadMenuIcon(ICON_MODEL_LUA_SCRIPTS, mask_model_lua_scripts, reload);
loadMenuIcon(ICON_MODEL_TELEMETRY, mask_model_telemetry, reload);
loadMenuIcon(ICON_MODEL_SELECT, mask_menu_model_select, reload);
loadMenuIcon(ICON_MODEL_SELECT_CATEGORY, mask_model_select_category, reload);
loadMenuIcon(ICON_STATS, mask_menu_stats, reload);
loadMenuIcon(ICON_STATS_THROTTLE_GRAPH, mask_stats_throttle_graph, reload);
loadMenuIcon(ICON_STATS_TIMERS, mask_stats_timers, reload);
loadMenuIcon(ICON_STATS_ANALOGS, mask_stats_analogs, reload);
loadMenuIcon(ICON_STATS_DEBUG, mask_stats_debug, reload);
loadMenuIcon(ICON_THEME, mask_menu_theme, reload);
loadMenuIcon(ICON_THEME_SETUP, mask_theme_setup, reload);
loadMenuIcon(ICON_THEME_VIEW1, mask_theme_view1, reload);
loadMenuIcon(ICON_THEME_VIEW2, mask_theme_view2, reload);
loadMenuIcon(ICON_THEME_VIEW3, mask_theme_view3, reload);
loadMenuIcon(ICON_THEME_VIEW4, mask_theme_view4, reload);
loadMenuIcon(ICON_THEME_VIEW5, mask_theme_view5, reload);
loadMenuIcon(ICON_THEME_ADD_VIEW, mask_theme_add_view, reload);
loadMenuIcon(ICON_MONITOR, mask_monitor, reload);
loadMenuIcon(ICON_MONITOR_CHANNELS1, mask_monitor_channels1, reload);
loadMenuIcon(ICON_MONITOR_CHANNELS2, mask_monitor_channels2, reload);
loadMenuIcon(ICON_MONITOR_CHANNELS3, mask_monitor_channels3, reload);
loadMenuIcon(ICON_MONITOR_CHANNELS4, mask_monitor_channels4, reload);
loadMenuIcon(ICON_MONITOR_LOGICAL_SWITCHES, mask_monitor_logsw, reload);
BitmapBuffer * background = BitmapBuffer::load8bitMask(mask_currentmenu_bg);
BitmapBuffer * shadow = BitmapBuffer::load8bitMask(mask_currentmenu_shadow);
@@ -280,10 +287,11 @@ class Theme480: public OpenTxTheme
update();
}
void update() const override
void update(bool reload = true) const override
{
loadIcons();
loadThemeBitmaps();
loadIcons(reload);
if (reload)
loadThemeBitmaps();
}
void drawBackground(BitmapBuffer * dc) const override
+1 -1
View File
@@ -278,7 +278,7 @@ class FlyskyTheme: public OpenTxTheme
update();
}
virtual void update() const override
virtual void update(bool reload = true) const override
{
TRACE("TODO THEME::UPDATE()");
+43 -1
View File
@@ -428,15 +428,57 @@ void ViewTextWindow::drawVerticalScrollbar(BitmapBuffer *dc)
#include "datastructs.h"
static void replaceSpaceWithUnderscore(std::string& name)
{
size_t index;
do {
index = name.find(' ');
if(index != std::string::npos)
name[index] = '_';
} while (index != std::string::npos);
}
bool openNotes(const char buf[], std::string modelNotesName)
{
if(isFileAvailable(modelNotesName.c_str())) {
new ViewTextWindow(std::string(buf), modelNotesName, ICON_MODEL);
return true;
} else {
return false;
}
}
void readModelNotes()
{
bool notesFound = false;
LED_ERROR_BEGIN();
std::string modelNotesName(g_model.header.name);
modelNotesName.append(TEXT_EXT);
const char buf[] = {MODELS_PATH};
f_chdir((TCHAR*)buf);
new ViewTextWindow(std::string(buf), modelNotesName, ICON_MODEL);
notesFound = openNotes(buf, modelNotesName);
if(!notesFound) {
replaceSpaceWithUnderscore(modelNotesName);
notesFound = openNotes(buf, modelNotesName);
}
#if !defined(EEPROM)
if(!notesFound) {
modelNotesName.assign(g_eeGeneral.currModelFilename);
size_t index = modelNotesName.find(".bin");
if(index != std::string::npos)
{
modelNotesName.erase(index);
modelNotesName.append(TEXT_EXT);
notesFound = openNotes(buf, modelNotesName);
}
if(!notesFound) {
replaceSpaceWithUnderscore(modelNotesName);
notesFound = openNotes(buf, modelNotesName);
}
}
#endif
LED_ERROR_END();
}
+7 -1
View File
@@ -830,7 +830,13 @@ bool isTrainerModeAvailable(int mode)
bool modelHasNotes()
{
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
char *buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)]);
char *buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)], 0);
strcpy(buf, TEXT_EXT);
if (isFileAvailable(filename)) {
return true;
}
buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)], ' ');
strcpy(buf, TEXT_EXT);
if (isFileAvailable(filename)) {
return true;