Ejemplo n.º 1
0
void FXRbSwitcher::markfunc(FXSwitcher *self){
  FXTRACE((100,"FXRbSwitcher::markfunc() %p\n",self));
  FXRbPacker::markfunc(self);
  }
Ejemplo n.º 2
0
void FXRbRealSlider::markfunc(FXRealSlider *self){
  FXTRACE((100,"FXRbRealSlider::markfunc() %p\n",self));
  FXRbFrame::markfunc(self);
  }
Ejemplo n.º 3
0
void FXRbMatrix::markfunc(FXMatrix *self){
  FXTRACE((100,"FXRbMatrix::markfunc() %p\n",self));
  FXRbPacker::markfunc(self);
  }
Ejemplo n.º 4
0
void FXRbMenuSeparator::markfunc(FXMenuSeparator *self){
  FXTRACE((100,"FXRbMenuSeparator::markfunc() %p\n",self));
  FXRbWindow::markfunc(self);
  }
Ejemplo n.º 5
0
void FXRbRGBIcon::markfunc(FXRGBIcon *self){
  FXTRACE((100,"FXRbRGBIcon::markfunc() %p\n",self));
  FXRbIcon::markfunc(self);
  }
Ejemplo n.º 6
0
void FXRbMDIDeleteButton::markfunc(FXMDIDeleteButton *self){
  FXTRACE((100,"FXRbMDIDeleteButton::markfunc() %p\n",self));
  FXRbButton::markfunc(self);
  }
Ejemplo n.º 7
0
// Handle directory
FXbool FXDirVisitor::enter(const FXString& path){
  FXTRACE((1,"enter(%s)\n",path.text()));
  return true;
  }
Ejemplo n.º 8
0
// Handle directory
FXbool FXDirVisitor::leave(const FXString& path){
  FXTRACE((1,"leave(%s)\n",path.text()));
  return true;
  }
Ejemplo n.º 9
0
// Recursively copy files or directories from srcfile to dstfile, overwriting dstfile if allowed
bool FXFile::copyFiles(const FXString& srcfile,const FXString& dstfile,bool overwrite){
  if(srcfile!=dstfile){
    FXString name,linkname;
    FXStat srcstat;
    FXStat dststat;
    FXTRACE((100,"FXFile::copyFiles(%s,%s)\n",srcfile.text(),dstfile.text()));
    if(FXStat::statLink(srcfile,srcstat)){

      // Destination is a directory?
      if(FXStat::statLink(dstfile,dststat)){
        if(!dststat.isDirectory()){
          if(!overwrite) return false;
          //FXTRACE((100,"FXFile::remove(%s)\n",dstfile.text()));
          if(!FXFile::remove(dstfile)) return false;
          }
        }

      // Source is a directory
      if(srcstat.isDirectory()){

        // Make destination directory if needed
        if(!dststat.isDirectory()){
          //FXTRACE((100,"FXDir::create(%s)\n",dstfile.text()));

          // Make directory
          if(!FXDir::create(dstfile,srcstat.mode()|FXIO::OwnerWrite)) return false;
          }

        // Open source directory
        FXDir dir(srcfile);

        // Copy source directory
        while(dir.next()){

          // Next name
          name=dir.name();

          // Skip '.' and '..'
          if(name[0]=='.' && (name[1]=='\0' || (name[1]=='.' && name[2]=='\0'))) continue;

          // Recurse
          if(!FXFile::copyFiles(srcfile+PATHSEP+name,dstfile+PATHSEP+name,overwrite)) return false;
          }

        // OK
        return true;
        }

      // Source is a file
      if(srcstat.isFile()){
        //FXTRACE((100,"FXFile::copyFile(%s,%s)\n",srcfile.text(),dstfile.text()));

        // Simply copy
        if(!FXFile::copy(srcfile,dstfile,overwrite)) return false;

        // OK
        return true;
        }

      // Source is symbolic link: make a new one
      if(srcstat.isLink()){
        linkname=FXFile::symlink(srcfile);
        FXTRACE((100,"symlink(%s,%s)\n",srcfile.text(),dstfile.text()));

        // New symlink to whatever old one referred to
        if(!FXFile::symlink(srcfile,dstfile)) return false;

        // OK
        return true;
        }

      // Source is fifo: make a new one
      if(srcstat.isFifo()){
        //FXTRACE((100,"FXPipe::create(%s)\n",dstfile.text()));

#if defined(FX_FOXCOMPAT) && !defined(FX_DISABLEGUI)
        // Make named pipe
        if(!FXPipe::create(dstfile,srcstat.mode())) return false;
#endif

        // OK
        return true;
        }

/*
  // Source is device: make a new one
  if(S_ISBLK(status1.st_mode) || S_ISCHR(status1.st_mode) || S_ISSOCK(status1.st_mode)){
    FXTRACE((100,"mknod(%s)\n",newfile.text()));
    return ::mknod(newfile.text(),status1.st_mode,status1.st_rdev)==0;
    }
*/

      }
    }
  return false;
  }
Ejemplo n.º 10
0
// Parse file
FXbool Parser::parse(FXSyntaxList& syntaxes){
  FXSyntax *syntax;
  FXString  name;

  FXTRACE((1,"Parser::parse: file = %s\n",file.text()));

  // Open file
  fp=fopen(file.text(),"r");
  if(!fp){
    fxwarning("error: unable to open file: %s.\n",file.text());
    return FALSE;
    }

  // Parse the languages
  while(token()){

    // Parse next language
    if(strcmp(tok,"language")!=0){
      fxwarning("%s:%d: error: expected 'language'.\n",file.text(),number);
      return FALSE;
      }

    // Parse language name
    name=string();

    // Make new language node
    syntax=new FXSyntax(name);

    // Add to list
    syntaxes.append(syntax);

    // Parse language info
    while(token()){
      if(strcmp(tok,"filesmatch")==0){          // File extensions
        syntax->setExtensions(string());
        continue;
        }
      if(strcmp(tok,"contentsmatch")==0){       // File contents
        syntax->setContents(string());
        continue;
        }
      if(strcmp(tok,"delimiters")==0){          // Word delimiters
        syntax->setDelimiters(string());
        continue;
        }
      if(strcmp(tok,"contextlines")==0){        // Context lines
        syntax->setContextLines(FXIntVal(word()));
        continue;
        }
      if(strcmp(tok,"contextchars")==0){        // Context chars
        syntax->setContextChars(FXIntVal(word()));
        continue;
        }
      break;
      }

    // Premature end
    if(!tok){
      fxwarning("%s:%d: error: unexpected end of file.\n",file.text(),number);
      return FALSE;
      }

    // Parse rules
    if(!parserules(syntax,0)) return FALSE;

    // Check end
    if(strcmp(tok,"end")!=0){
      fxwarning("%s:%d: error: expected 'end'.\n",file.text(),number);
      return FALSE;
      }
    }
  FXTRACE((1,"Parser::parse: OK\n"));
  return TRUE;
  }
Ejemplo n.º 11
0
// Parse rules and sub rules
FXbool Parser::parserules(FXSyntax *syntax,FXint parent){
  FXString   name,brex,erex,srex;
  FXRex      expression;
  FXRexError error;
  FXint      index;

  FXTRACE((1,"parserules begin parent = %d\n",parent));

  // Parse the rules
  while(strcmp(tok,"rule")==0){

    // Parse name
    name=string();

    // Clear to empty
    brex=FXString::null;
    erex=FXString::null;
    srex=FXString::null;

    // Parse rule info
    while(token()){
      if(strcmp(tok,"pattern")==0){             // Simple pattern
        brex=string();
        if((error=expression.parse(brex,REX_SYNTAX))!=REGERR_OK){
          fxwarning("%s:%d: error: %s.\n",file.text(),number,FXRex::getError(error));
          return FALSE;
          }
        continue;
        }
      if(strcmp(tok,"openpattern")==0){         // Open pattern
        brex=string();
        if((error=expression.parse(brex,REX_SYNTAX))!=REGERR_OK){
          fxwarning("%s:%d: error: %s.\n",file.text(),number,FXRex::getError(error));
          return FALSE;
          }
        continue;
        }
      if(strcmp(tok,"closepattern")==0){        // Close pattern
        erex=string();
        if((error=expression.parse(erex,REX_SYNTAX))!=REGERR_OK){
          fxwarning("%s:%d: error: %s.\n",file.text(),number,FXRex::getError(error));
          return FALSE;
          }
        continue;
        }
      if(strcmp(tok,"stoppattern")==0){         // Stop pattern
        srex=string();
        if((error=expression.parse(srex,REX_SYNTAX))!=REGERR_OK){
          fxwarning("%s:%d: error: %s.\n",file.text(),number,FXRex::getError(error));
          return FALSE;
          }
        continue;
        }
      break;
      }

    // Premature end
    if(!tok){
      fxwarning("%s:%d: error: unexpected end of file.\n",file.text(),number);
      return FALSE;
      }

    FXTRACE((1,"brex = %s\n",brex.text()));
    FXTRACE((1,"erex = %s\n",erex.text()));
    FXTRACE((1,"srex = %s\n",srex.text()));

    // Validation
    if(brex.empty()) return FALSE;

    // Create rule
    if(erex.empty() && srex.empty()){
      index=syntax->append(name,brex,parent);
      }
    else if(srex.empty()){
      index=syntax->append(name,brex,erex,parent);
      }
    else{
      index=syntax->append(name,brex,erex,srex,parent);
      }

    // Parse subrules, if any
    if(!parserules(syntax,index)) return FALSE;

    // Check end
    if(strcmp(tok,"end")!=0){
      fxwarning("%s:%d: error: expected 'end'.\n",file.text(),number);
      return FALSE;
      }

    // Next token
    token();
    if(!tok) return FALSE;
    }
  FXTRACE((1,"parserules end parent = %d\n",parent));
  return TRUE;
  }
Ejemplo n.º 12
0
// Somebody wants our selection
long ShutterBug::onClipboardRequest(FXObject* sender,FXSelector sel,void* ptr){
  FXEvent *event=(FXEvent*)ptr;
  FXuchar *pointer;
  FXuval   length;

  FXTRACE((1,"%s::onClipboardRequest \n",getClassName()));

  // Try handling it in base class first
  if(FXShell::onClipboardRequest(sender,sel,ptr)) return 1;

  if(clipbuffer){

    // One of the supported image types?
    if(event->target==dndTypes[0] || event->target==dndTypes[1] || event->target==dndTypes[2] || event->target==dndTypes[3] || event->target==dndTypes[4] || event->target==dndTypes[5] || event->target==dndTypes[6]){
      FXMemoryStream ms;

      // Open memory stream
      ms.open(FXStreamSave,NULL,0);

      // Render image to memory stream
      if(event->target==dndTypes[0]){
        FXTRACE((1,"Request for bmpType\n"));
        fxsaveBMP(ms,clipbuffer,clipwidth,clipheight);
        }
      else if(event->target==dndTypes[1]){
        FXTRACE((1,"Request for gifType\n"));
        fxsaveGIF(ms,clipbuffer,clipwidth,clipheight);
        }
      else if(event->target==dndTypes[2]){
        FXTRACE((1,"Request for xpmType\n"));
        fxsaveXPM(ms,clipbuffer,clipwidth,clipheight);
        }
      else if(event->target==dndTypes[3]){
        FXTRACE((1,"Request for ppmType\n"));
        fxsavePPM(ms,clipbuffer,clipwidth,clipheight);
        }
      else if(event->target==dndTypes[4]){
        FXTRACE((1,"Request for jpgType\n"));
        fxsaveJPG(ms,clipbuffer,clipwidth,clipheight,75);
        }
      else if(event->target==dndTypes[5]){
        FXTRACE((1,"Request for pngType\n"));
        fxsavePNG(ms,clipbuffer,clipwidth,clipheight);
        }
      else if(event->target==dndTypes[6]){
        FXTRACE((1,"Request for tifType\n"));
        fxsaveTIF(ms,clipbuffer,clipwidth,clipheight,0);
        }
#ifdef WIN32
  //  else if(event->target==imageType){
  //    FXTRACE((1,"Request for imageType\n"));
  //    fxsaveBMP(ms,chart->getData(),chart->getWidth(),chart->getHeight());
  //    }
#endif

      // Grab buffered image
      ms.takeBuffer(pointer,length);

      // Close memory stream
      ms.close();

      // Set DND data
      setDNDData(FROM_CLIPBOARD,event->target,pointer,length);
      return 1;
      }
    }
  return 0;
  }
Ejemplo n.º 13
0
// Quit
long ShutterBug::onCmdQuit(FXObject*,FXSelector,void*){
  FXTRACE((1,"quit\n"));
  writeRegistry();
  getApp()->exit();
  return 1;
  }