Esempio n. 1
0
FileType *BaseEditor::chooseFileType(const String *fileName)
{
  if (lineSource == null)
  {
    currentFileType = hrcParser->chooseFileType(fileName, null);
  }
  else
  {
    int chooseStr=CHOOSE_STR, chooseLen=CHOOSE_LEN;
    DString dsd("default");
    FileType *def = hrcParser->getFileType(&dsd);
    if(def)
    {
      chooseStr = def->getParamValueInt(DString("firstlines"), chooseStr);
      chooseLen = def->getParamValueInt(DString("firstlinebytes"), chooseLen);
    }
    
    currentFileType = chooseFileTypeCh(fileName, chooseStr, chooseLen);
  }
  setFileType(currentFileType);
  return currentFileType;
}
Esempio n. 2
0
void FarEditor::reloadTypeSettings()
{
  FileType *ftype = baseEditor->getFileType();
  HRCParser *hrcParser = parserFactory->getHRCParser();
  DString ds("default") ;
  FileType *def = hrcParser->getFileType(&ds);

  if (def == nullptr){
    throw Exception(DString("No 'default' file type found"));
  }

  int backparse = def->getParamValueInt(DBackparse, 2000);
  maxLineLength = def->getParamValueInt(DMaxLen, 0);
  newfore = def->getParamValueInt(DDefFore, -1);
  newback = def->getParamValueInt(DDefBack, -1);
  const String *value;
  value = def->getParamValue(DFullback);

  if (value != nullptr && value->equals(&DNo)){
    fullBackground = false;
  }

  value = def->getParamValue(DShowCross);
  if (drawCross==2 && value != nullptr){
    if (value->equals(&DNone)){
      showHorizontalCross = false;
      showVerticalCross   = false;
    };

    if (value->equals(&DVertical)){
      showHorizontalCross = false;
      showVerticalCross   = true;
    };

    if (value->equals(&DHorizontal)){
      showHorizontalCross = true;
      showVerticalCross   = false;
    };

    if (value->equals(&DBoth)){
      showHorizontalCross = true;
      showVerticalCross   = true;
    };
  }

  value = def->getParamValue(DCrossZorder);

  if (value != nullptr && value->equals(&DTop)){
    crossZOrder = 1;
  }

  // installs custom file properties
  backparse = ftype->getParamValueInt(DBackparse, backparse);
  maxLineLength = ftype->getParamValueInt(DMaxLen, maxLineLength);
  newfore = ftype->getParamValueInt(DDefFore, newfore);
  newback = ftype->getParamValueInt(DDefBack, newback);
  value = ftype->getParamValue(DFullback);

  if (value != nullptr && value->equals(&DNo)){
    fullBackground = false;
  }

  value = ftype->getParamValue(DShowCross);

  if (drawCross==2 && value != nullptr){
    if (value->equals(&DNone)){
      showHorizontalCross = false;
      showVerticalCross   = false;
    };

    if (value->equals(&DVertical)){
      showHorizontalCross = false;
      showVerticalCross   = true;
    };

    if (value->equals(&DHorizontal)){
      showHorizontalCross = true;
      showVerticalCross   = false;
    };

    if (value->equals(&DBoth)){
      showHorizontalCross = true;
      showVerticalCross   = true;
    };
  }

  value = ftype->getParamValue(DCrossZorder);

  if (value != nullptr && value->equals(&DTop)){
    crossZOrder = 1;
  }

  baseEditor->setBackParse(backparse);
}