Beispiel #1
0
long
MembersFrame::onApplyChanges(FXObject*,FXSelector,void*)
{
  FXFoldingItem *mitem = memberslist->findItemByData((void*)editedmember);
  FXString newname = nametf->getText();
  FXString newlogin = logintf->getText();

  if (mitem) {
    newname.trim();
    newlogin.trim();
    CCL_member_tarif_set(editedmember,tarifset);
    if (!newname.empty() && -1 == CCL_member_find(newname.text()))
      CCL_member_name_set(editedmember,nametf->getText().text());
    CCL_member_email_set(editedmember,emailtf->getText().text());
    CCL_member_other_set(editedmember,phonetf->getText().text());
    if (newlogin.empty() && CCL_data_key_exists(CCL_DATA_MEMBER,editedmember,
						"login_name"))
      CCL_data_key_delete(CCL_DATA_MEMBER,editedmember,"login_name");
    else if (-1 == CCL_data_find_by_key_sval(CCL_DATA_MEMBER,"login_name",
					     newlogin.text()))
      CCL_data_set_string(CCL_DATA_MEMBER,editedmember,"login_name",
			  newlogin.text());
    mitem->setText(FXStringVal((FXint)editedmember) + "\t" + CCL_member_name_get(editedmember));
    memberslist->updateItem(mitem);
  }
#ifdef DEBUG
  printf("onApplyChanges(): Apply Changes Button was pressed\n");
#endif
  
  return 1;
}
Beispiel #2
0
long
GNETLSEditorFrame::onCmdPhaseEdit(FXObject*, FXSelector, void* ptr) {
    /* @note: there is a bug when copying/pasting rows: when this handler is
     * called the value of the cell is not yet updated. This means you have to
     * click inside the cell and hit enter to actually update the value */
    FXTablePos* tp = (FXTablePos*)ptr;
    FXString value = myPhaseTable->getItemText(tp->row, tp->col);
    if (tp->col == 0) {
        // duration edited
        if (GNEAttributeCarrier::canParse<SUMOReal>(value.text())) {
            SUMOTime duration = getSUMOTime(value);
            if (duration > 0) {
                myEditedDef->getLogic()->setPhaseDuration(tp->row, duration);
                myHaveModifications = true;
                updateCycleDuration();
                return 1;
            }
        }
        // input error, reset value
        myPhaseTable->setItemText(tp->row, 0, toString(STEPS2TIME(getPhases()[tp->row].duration)).c_str());
    } else {
        // state edited
        try {
            // insert phase with new step and delete the old phase
            myEditedDef->getLogic()->addStep(getPhases()[tp->row].duration, value.text(), tp->row);
            myEditedDef->getLogic()->deletePhase(tp->row + 1);
            myHaveModifications = true;
            onCmdPhaseSwitch(0, 0, 0);
        } catch (ProcessError) {
            // input error, reset value
            myPhaseTable->setItemText(tp->row, 1, getPhases()[tp->row].state.c_str());
        }
    }
    return 1;
}
void InputThread::ctrl_open_input(const FXString & uri) {
  GM_DEBUG_PRINT("[input] ctrl_open_input %s\n",uri.text());

  if (uri.empty()) {
    goto failed;
    }

  /// Open Input
  input=open_input(uri);
  if (input==NULL) {
    engine->post(new ErrorMessage(FXString::value("Unable to open %s",uri.text())));
    goto failed;
    }

  reader = open_reader();
  if (reader==NULL) {
    engine->post(new ErrorMessage(FXString::value("No input plugin available for %s",uri.text())));
    goto failed;
    }

  if (!reader->init(input)) {
    engine->post(new ErrorMessage(FXString::value("Failed to initialize plugin")));
    goto failed;
    }

  streamid++;
  set_state(StateProcessing,true);
  return;
failed:
  ctrl_close_input();
  set_state(StateIdle,true);
  }
Beispiel #4
0
// Open directory to path, return true if ok.
FXbool FXDir::open(const FXString& path){
  if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
    FXnchar buffer[MAXPATHLEN];
    utf2ncs(buffer,MAXPATHLEN,path.text(),path.length()+1);
    wcsncat(buffer,TEXT("\\*"),MAXPATHLEN);
#else
    FXchar buffer[MAXPATHLEN];
    strncpy(buffer,path.text(),MAXPATHLEN);
    strncat(buffer,"\\*",MAXPATHLEN);
#endif
    ((SPACE*)space)->handle=FindFirstFile(buffer,&((SPACE*)space)->result);
    if(((SPACE*)space)->handle!=INVALID_HANDLE_VALUE){
      ((SPACE*)space)->first=true;
      return true;
      }
#else
    ((SPACE*)space)->handle=opendir(path.text());
    if(((SPACE*)space)->handle!=NULL){
      return true;
      }
#endif
    }
  return false;
  }
Beispiel #5
0
/*
  Fox doesn't automatically handle MS-Windows shortcut files, so...
  Iterate through each filename in the file dialog's getFilenames() list,
  if any of them are shortcut (*.lnk) files, dereference the link and
  make the string point to the "real" disk file. If we have multiple files,
  remove any links that point to a directory. But if we only have one string
  in the list, and the string is a link pointing to a directory, we will
  dereference it so the dialog can change into that folder.
*/
static void FixupShortcuts(FXWindow*w, FXString* filenames)
{
  if (!filenames) return;
  FXString* fn;
  FXString* tail=filenames;
  FXuint count=0;
  for (fn=filenames; !fn->empty(); fn++) {
    if (IsLinkExt(*fn)) {
      char*tmp=NULL;
      if (ReadShortcut(&tmp, fn->text())) {
        *fn=tmp;
      } else {
        FXMessageBox::error(w,MBOX_OK,_("Error in shortcut"),"%s\n%s",fn->text(),tmp);
      }
      free(tmp);
    }
    tail=fn;
    count++;
  }
  if (count>1) {
    for (fn=filenames; !fn->empty(); fn++) {
      if (FXStat::isDirectory(*fn)) {
        *fn=tail->text();
        *tail="";
        tail--;
      }
    }
  }
}
Beispiel #6
0
// Get home directory for a given user
FXString FXSystem::getUserDirectory(const FXString& user){
#ifndef WIN32
#if defined(FOX_THREAD_SAFE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
  struct passwd pwdresult,*pwd;
  char buffer[1024];
  if(user.empty()){
    register const FXchar* str;
    if((str=getenv("HOME"))!=NULL) return str;
    if((str=getenv("USER"))!=NULL || (str=getenv("LOGNAME"))!=NULL){
      if(getpwnam_r(str,&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
      }
    if(getpwuid_r(getuid(),&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
    return PATHSEPSTRING;
    }
  if(getpwnam_r(user.text(),&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
  return PATHSEPSTRING;
#else
  register struct passwd *pwd;
  if(user.empty()){
    register const FXchar* str;
    if((str=getenv("HOME"))!=NULL) return str;
    if((str=getenv("USER"))!=NULL || (str=getenv("LOGNAME"))!=NULL){
      if((pwd=getpwnam(str))!=NULL) return pwd->pw_dir;
      }
    if((pwd=getpwuid(getuid()))!=NULL) return pwd->pw_dir;
    return PATHSEPSTRING;
    }
  if((pwd=getpwnam(user.text()))!=NULL) return pwd->pw_dir;
  return PATHSEPSTRING;
#endif
#else
  if(user.empty()){
    register const FXchar *str1,*str2;
    FXchar home[MAXPATHLEN];
    DWORD size=MAXPATHLEN;
    HKEY hKey;
    LONG result;
    if((str1=getenv("USERPROFILE"))!=NULL) return str1; // Daniël Hörchner <*****@*****.**>
    if((str1=getenv("HOME"))!=NULL) return str1;
    if((str2=getenv("HOMEPATH"))!=NULL){      // This should be good for WinNT, Win2K according to MSDN
      if((str1=getenv("HOMEDRIVE"))==NULL) str1="c:";
      strncpy(home,str1,MAXPATHLEN);
      strncat(home,str2,MAXPATHLEN);
      return home;
      }
//  FXchar buffer[MAX_PATH]
//  if(SHGetFolderPath(NULL,CSIDL_PERSONAL|CSIDL_FLAG_CREATE,NULL,O,buffer)==S_OK){
//    return buffer;
//    }
    if(RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",0,KEY_READ,&hKey)==ERROR_SUCCESS){
      result=RegQueryValueExA(hKey,"Personal",NULL,NULL,(LPBYTE)home,&size);  // Change "Personal" to "Desktop" if you want...
      RegCloseKey(hKey);
      if(result==ERROR_SUCCESS) return home;
      }
    return "c:" PATHSEPSTRING;
    }
  return "c:" PATHSEPSTRING;
#endif
  }
Beispiel #7
0
// Symbolic Link file
bool FXFile::symlink(const FXString& oldfile,const FXString& newfile){
  if(newfile!=oldfile){
#ifndef WIN32
    return ::symlink(oldfile.text(),newfile.text())==0;
#endif
    }
  return false;
  }
// Copy ordinary file
static FXbool copyfile (const FXString & oldfile, const FXString & newfile, thread_elem * te)
{
    unsigned char buffer[4096];
    struct stat status;
    long nread, nwritten;
    int src, dst;
    FXbool ok = FALSE;
    if ((src = open (oldfile.text (), O_RDONLY)) >= 0)
    {
	if (::stat (oldfile.text (), &status) == 0)
	{


	    te->act_file_name = oldfile.text ();
	    te->act_file_size = 1;
	    te->file_size = status.st_size;



	    if ((dst = open (newfile.text (), O_WRONLY | O_CREAT | O_TRUNC, status.st_mode)) >= 0)
	    {
		while (1)
		{
		    nread = fullread (src, buffer, sizeof (buffer));
		    if (nread < 0)
			goto err;
		    if (nread == 0)
			break;




		    if (te->cancel == true)
		    {
			fxmessage ("CANCEL CANCEL CANCEL CANCEL !!!\n\n\n\n\n");
			close (dst);
			close (src);
			return FALSE;
		    }

		    te->act_file_size += nread;
		    te->act_total_size += nread;



		    nwritten = fullwrite (dst, buffer, nread);
		    if (nwritten < 0)
			goto err;
		}
		ok = TRUE;
	      err:close (dst);
	    }
	}
	close (src);
    }
    return ok;
}
Beispiel #9
0
// Return true if files are identical
// Compare file names and inodes for case insensitive filesystems
FXbool identical(const FXString& file1,const FXString& file2)
{
	if(file1!=file2)
	{
    	struct stat linfo1, linfo2;
    	return !::lstatrep(file1.text(),&linfo1) && !::lstatrep(file2.text(),&linfo2) && linfo1.st_ino==linfo2.st_ino && linfo1.st_dev==linfo2.st_dev;
    }
  	return TRUE;
}
Beispiel #10
0
bool SciDocUtils::InsertFile(SciDoc *sci, const FXString &filename)
{
  if (sci->InsertFile(filename.text())) {
     sci->ScrollWrappedInsert();
    return true;
  } else {
    FXMessageBox::error(sci->getShell(), MBOX_OK, _("Error opening file"), "%s:\n%s\n%s",
       _("Could not open file"), filename.text(), sci->GetLastError().text());
  }
  return false;
}
Beispiel #11
0
// Return value of environment variable name
FXString FXSystem::getEnvironment(const FXString& name){
  if(!name.empty()){
#ifndef WIN32
    return FXString(getenv(name.text()));
#else
    FXchar value[1024];
    DWORD len=GetEnvironmentVariableA(name.text(),value,1024);
    return FXString(value,len);
#endif
    }
  return FXString::null;
  }
Beispiel #12
0
tDato FXTabSim::buscarSIM(char *id) {
	FXint i, j, num, fin;
	FXString nomTipo;
	FXString strAux;
	FXint *tipo;
	FXchar clave[20];

	j = tope;

	while ( j > 0 ) {

		// Los parametros formales NO sirven
		fin = 0;
		do {

			strAux = getItemText(j, COL_TIPOTS);
			if ( strcmp(strAux.text(), "PAR_FORMAL") != 0 )
				fin = 1;
			else
				j--;

		} while ( fin == 0 );

		strAux = getItemText(j, COL_LEXEMA);

		if ( strcmp(strAux.text(), id) == 0 ) {

			nomTipo = getItemText(j, COL_TDATO);

			for ( i = 0
				; strcmp(nomTipo.text(), nomTiposDato[i]) != 0
				; i++ );

			printf("Encontrado %s tipo: %d\n", id, i);

			// Seleccionamos el item encontrado en la TS
			setSelTextColor(colores[SIM_FG]);
			setSelBackColor(colores[SIM_BG]);
			// selectRange(j, j, COL_LEXEMA, COL_TDATO);
			selectRange(j, j, COL_LEXEMA, COL_ETQ_ELSE);
			itemSelMin = j;
			itemSelMax = j+1;

			return (tDato)i;

		} else {
			j--;
			}
		}

	return DESC;
	}
Beispiel #13
0
void SetKeywordList(LangStyle*lang, int index, const FXString &keywords)
{
  FXuint flag=1<<index;
  if (!lang) { return; }
  if ((index<0)||(index>=KeywordListsCount(lang))) { return; }
  if (strcmp(keywords.text(),lang->words[index])==0) { return; }
  if ( lang->mallocs & flag ) {
    free(lang->words[index]);
    lang->words[index]=NULL;
  }
  lang->words[index]=strdup(keywords.text());
  lang->mallocs |= flag;
}
Beispiel #14
0
/*
  Read the Windows shortcut (*.lnk) file passed in as "filename".
  If the filename does not end with the *.lnk extension, returns
  true, the filename parameter is unchanged.
  If the link cannot be read (e.g. corrupted file) it displays an
  error dialog describing the reason for the failure and returns
  false, the filename parameter is unchanged.
  If reading of the link is successful, it returns true and the
  "filename" parameter is modified and will contain the name of
  the file that the shortcut points to.
*/
bool FileDlg::ReadShortcut(FXWindow*w, FXString &filename)
{
  bool rv=true;
  if (IsLinkExt(filename)) {
    char*tmp=NULL;
     if (::ReadShortcut(&tmp, filename.text())) {
      filename=FXPath::simplify(FXPath::absolute(tmp));
    } else {
      FXMessageBox::error(w,MBOX_OK,_("Error in shortcut"),"%s\n%s",filename.text(),tmp);
      rv=false;
    }
    free(tmp);
  }
  return rv;
}
Beispiel #15
0
// Look for file: first in active document's directory; then in current working directory
static bool OpenLocalIncludeFile(SciDoc*sci, const FXString &filename, const FXString &line)
{
  if (!sci->Filename().empty()) {
    FXString fullpath=FXPath::directory(sci->Filename())+PATHSEPSTRING+filename;
    if (FXStat::exists(fullpath)) {
      TopWinPub::OpenFile(fullpath.text(),line.text(),false,true);
      return true;
    }
  }
  if (FXStat::exists(filename)) {
    TopWinPub::OpenFile(filename.text(),line.text(),false,true);
    return true;
  }
  return false;
}
Beispiel #16
0
void GMSourceView::loadSettings(const FXString & key) {
  FXbool sort_reverse,view;

  sort_reverse = getApp()->reg().readBoolEntry(key.text(),"source-list-sort-reverse",false);
  if (sort_reverse)
    sourcelist->setSortFunc(source_list_sort_reverse);
  else
    sourcelist->setSortFunc(source_list_sort);

  view = getApp()->reg().readBoolEntry(key.text(),"source-list",true);
  if (view)
    getParent()->show();
  else
    getParent()->hide();
  }
Beispiel #17
0
FXbool ID3V2::parse_text(FXint encoding,const FXchar * buffer,FXint length,FXString & text){
  switch(encoding) {

    case ISO_8859_1 :
      {
        FX88591Codec codec;
        FXint n = codec.mb2utflen(buffer,length);
        if (n>0) {
          text.length(n);
          codec.mb2utf(text.text(),text.length(),buffer,length);
          }
      } break;

    case UTF16_BOM  :
      {
        FXUTF16Codec codec;
        FXint n = codec.mb2utflen(buffer,length);
        if (n>0) {
          text.length(n);
          codec.mb2utf(text.text(),text.length(),buffer,length);
          }
      } break;

    case UTF16      :
      {
        FXUTF16BECodec codec;
        FXint n = codec.mb2utflen(buffer,length);
        if (n>0) {
          text.length(n);
          codec.mb2utf(text.text(),text.length(),buffer,length);
          }

      } break;

    case UTF8      :
      {
        FXUTF8Codec codec;
        FXint n = codec.mb2utflen(buffer,length);
        if (n>0) {
          text.length(n);
          codec.mb2utf(text.text(),text.length(),buffer,length);
          }

      } break;
    default: return false;
    }
  return true;
  }
Beispiel #18
0
long fx_numeric_field::change_on_digit(int sign)
{
    FXString txt = getText();
    int pos = getCursorPos();

    int pow_exp, dot_pos;
    int norm = get_normalized_int (txt.text(), pow_exp, dot_pos);

    if (dot_pos < 0) return 0;

    int pos_exp = dot_pos - pos;
    if (pos_exp < 0)
        pos_exp ++;
    int inc_abs = ipow10 (pos_exp + pow_exp);

    norm += sign * inc_abs;

    FXString new_txt = denormalize (norm, pow_exp, dot_pos);
    int new_pos = dot_pos - pos_exp;
    if (pos_exp < 0)
        new_pos ++;

    setText(new_txt);
    setCursorPos(new_pos);

    if (target)
        target->tryHandle(this, FXSEL(SEL_CHANGED,message), (void*)new_txt.text());

    return 1;
}
Beispiel #19
0
bool
checkPass(char *pass, int plen)
{
  char pstr[64];
  FILE *fp;
  FXString pname;

  pname = FXSystem::getHomeDirectory() + "/.mkahawa/mkahawa.inf";
  fp = fopen(pname.text(), "r");
  if (fp){
    FXuchar digest[CCLC_MD5_DIGEST_LENGTH];

    CCLC_MD5((FXuchar*)(pass), plen, digest);
    fread(pstr, CCLC_MD5_DIGEST_LENGTH, 1, fp);
    if (plen > CCLC_MD5_DIGEST_LENGTH) plen = CCLC_MD5_DIGEST_LENGTH;
    if (!memcmp(pstr, digest, plen))
      return TRUE;
    fclose(fp);
#ifdef DEBUG_PASS
    printf("Realpass Hash: ");
    print_hash((unsigned char *)digest, CCLC_MD5_DIGEST_LENGTH);
    printf("\n");
    printf("Testpass Hash: ");
    print_hash((unsigned char *)pstr, CCLC_MD5_DIGEST_LENGTH);
    printf("\n");
#endif
  }
  
  return FALSE;
}
Beispiel #20
0
long
setAdminPass(char *pass, int plen)
{

  FXString path = FXSystem::getHomeDirectory() + "/.mkahawa";
  FXString fname = "mkahawa.inf";

#ifdef DEBUG_PASS
  printf("setAdminPass(): pass = %s\n", pass);
#endif
  if (!FXStat::exists(path))
    if (!FXDir::create(path, FXIO::OwnerFull))
      return 0;
  path += "/" + fname;
  if (!FXStat::exists(path))
    if (!FXFile::create(path,FXIO::OwnerFull))
      return 0;
  FILE *fp = fopen(path.text(), "w");
  if (fp){
    FXuchar digest[CCLC_MD5_DIGEST_LENGTH];

    memset(digest, 0, CCLC_MD5_DIGEST_LENGTH);
    CCLC_MD5((FXuchar*)(pass), plen, digest);
    fwrite(digest, CCLC_MD5_DIGEST_LENGTH , 1, fp);
#ifdef DEBUG_PASS
    printf("setAdminPass()\n");
    printf("Testpass Hash: ");
    print_hash((unsigned char *)digest, CCLC_MD5_DIGEST_LENGTH);
    printf("\n");
#endif
    fclose(fp);
  }
  
  return 1;
}
Beispiel #21
0
bool BackupMgr::SaveBackup(SciDoc*sci)
{
  FXString savename;
  FXString untitled;
  untitled.format(FN_FMT, backupdir.text(), abs(getpid()), SciDocUtils::ID(sci));
  if (SciDocUtils::Filename(sci).empty()) {
    savename=untitled;
  } else {
    if (FXStat::isFile(untitled)) {
      RemoveBackup(untitled);
    }
#ifdef WIN32
    savename=SciDocUtils::Filename(sci).text();
    savename.substitute(':', '%', true);
    savename.prepend(backupdir.text());
#else
    savename.format("%s%s", backupdir.text(), SciDocUtils::Filename(sci).text());
#endif
  }
  if (MakePath(FXPath::directory(savename))) {
    if (SciDocUtils::SaveToFile(sci,savename.text(),false)) {
      SciDocUtils::NeedBackup(sci, false);
      return true;
    } else {
      lasterror=SciDocUtils::GetLastError(sci);
      ErrorMessage(_("Failed to save backup"), savename);
      return false;
    }
  } else {
    return false;
  }
}
Beispiel #22
0
// Create new directory
FXbool FXDir::create(const FXString& path,FXuint perm){
  if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
    FXnchar buffer[MAXPATHLEN];
    utf2ncs(buffer,MAXPATHLEN,path.text(),path.length()+1);
    return CreateDirectoryW(buffer,NULL)!=0;
#else
    return CreateDirectoryA(path.text(),NULL)!=0;
#endif
#else
    return ::mkdir(path.text(),perm)==0;
#endif
    }
  return false;
  }
Beispiel #23
0
// Remove directory
FXbool FXDir::remove(const FXString& path){
  if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
    FXnchar buffer[MAXPATHLEN];
    utf2ncs(buffer,MAXPATHLEN,path.text(),path.length()+1);
    return RemoveDirectoryW(buffer)!=0;
#else
    return RemoveDirectoryA(path.text())!=0;
#endif
#else
    return ::rmdir(path.text())==0;
#endif
    }
  return false;
  }
// Run ctags in each source directory
void TagParserBase::ReadClasses()
{
  CmdIO cmdio(mainwin);
  CmdStr cmd=CtagsCmd();
  FXString currdir=FXSystem::getCurrentDirectory();
  FXRex rx("\\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$",FXRex::IgnoreCase);
  for (FXint i=0; i<DirList().no(); i++) {
    const FXString dir=DirList().at(i)->dirname();
    if (dir.empty()) { continue; }
    if (FXSystem::setCurrentDirectory(dir)) {
      FXDir de(dir);
      if (de.isOpen()) {
        FXString fn;
        while (de.next(fn)) {
          if (FXStat::isFile(fn) && (rx.search(fn,0,fn.length())>=0)) { cmd+=fn.text(); }
        }
        de.close();
        current_filename=FXString::null;
        cmdio.setUserData((void*)(FXival)i);
        cmdio.lines(cmd.text(),this,ID_READ_ALL_FILES_LINES);
      }
    }
  }
  FXSystem::setCurrentDirectory(currdir);
}
Beispiel #25
0
// Change current directory
FXbool FXSystem::setCurrentDirectory(const FXString& path){
  if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
    TCHAR buffer[MAXPATHLEN];
    utf2ncs(buffer,path.text(),path.length()+1);
    return SetCurrentDirectory(buffer);
#else
    return SetCurrentDirectory(path.text());
#endif
#else
    return chdir(path.text())==0;
#endif
    }
  return FALSE;
  }
Beispiel #26
0
// Construct a dialog box
InputDialog::InputDialog(FXWindow *win,FXString inp,FXString message,FXString title,FXString label,FXIcon *icon, FXbool option, FXString optiontext):
        DialogBox(win,title,DECOR_TITLE|DECOR_BORDER|DECOR_STRETCHABLE)
{
    // Buttons
    FXHorizontalFrame *buttons=new FXHorizontalFrame(this,PACK_UNIFORM_WIDTH|LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X,0,0,0,0,10,10,5,5);
    
	// Accept
    new FXButton(buttons,_("&Accept"),NULL,this,ID_ACCEPT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT,0,0,0,0,20,20);
    
	// Cancel
    new FXButton(buttons,_("&Cancel"),NULL,this,ID_CANCEL,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT,0,0,0,0,20,20);
    
	// Separator
    new FXHorizontalSeparator(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|SEPARATOR_GROOVE);

	// Optional check box
	checkbutton=new FXHorizontalFrame(this,JUSTIFY_RIGHT|LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X,0,0,0,0,10,10,0,0);
    
	if (option)
        new FXCheckButton(checkbutton,optiontext,this,ID_TOGGLE_OPTION);

    // Vertical frame
	FXVerticalFrame *contents=new FXVerticalFrame(this,LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y);

	// Icon and message line
	FXMatrix *matrix = new FXMatrix(contents,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
	new FXLabel(matrix,"",icon,LAYOUT_LEFT);    
	new FXLabel(matrix,message.text(),NULL,JUSTIFY_LEFT|LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
	
	// Label and input field
	new FXLabel(matrix,label,NULL,LAYOUT_RIGHT|LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
	input = new FXTextField(matrix,40,0,0,LAYOUT_CENTER_Y|LAYOUT_CENTER_X|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
	input->setText(inp);
}
Beispiel #27
0
long
GenesisFrame::onName(FXObject *a_src, FXSelector, void *)
{
  if (m_commandLineHandler->busy())
    return 1;

  char *name, option[80];
  FXString text;
  if (a_src == m_changeForeignName)
    text = m_foreignName->getText();
  else
    text = m_JapaneseName->getText();
  name = (char *) text.text();
  if (!name[0]) // don't use trim() -- name may start/end with space
    {
      FXMessageBox::warning(this, MBOX_OK, "No name specified",
        "Please specify a name");
      return 1;
    }
  if (strlen(name) >= 80)
    name[80 - 1] = 0;
  // it would be 100% correct if we used two hyphens for -n2
#ifdef  __unix__
  sprintf(option, "-n%s=%s", a_src == m_changeJapaneseName ? "2" : "", name);
#else
  sprintf(option, "-n%s=\"%s\"", a_src == m_changeJapaneseName ? "2" : "", name);
#endif
  m_commandLineHandler->setOption(option, true);
  setOverrideOptions();
  m_commandLineHandler->run();
  return 1;
}
Beispiel #28
0
long
GenesisFrame::onReceive(FXObject *, FXSelector, void *)
{
  if (m_commandLineHandler->busy())
    return 1;

  FXString text = FileDialog::getSaveFilename(this, "Specify file name to write to",
    "dummy");
  char *filename = (char *) text.text();
  if (!filename[0])
    return 1;
  else if (FXStat::exists(filename))
    {
      FXMessageBox::warning(this, MBOX_OK, "File already exists",
        "Please specify a different file name");
      return 1;
    }

  setTransferOption(false);
  setOverrideOptions();
  char *ptr;
#ifdef  __unix__
  ptr = filename;
#else
  {
    char option[FILENAME_MAX + 3];
    sprintf(option, "\"%s\"", filename);
    ptr = option;
  }
#endif
  m_commandLineHandler->addOption(ptr);
  m_commandLineHandler->run();
  return 1;
}
Beispiel #29
0
void
GenesisFrame::setOverrideOptions(void)
{
  if (m_useOverride->getCheck())
    {
      if (m_overrideGenesis->getCheck())
        m_commandLineHandler->addOption("--gen");
      if (m_overrideHeaderSize->getCheck())
        {
          char option[80];
          FXString text = m_overrideHeaderSizeText->getText();
          sprintf(option, "--hdn=%s", text.text());
          m_commandLineHandler->addOption(option);
        }
      if (m_overrideHeader->getCheck())
        m_commandLineHandler->addOption("--hd");
      if (m_overrideNoHeader->getCheck())
        m_commandLineHandler->addOption("--nhd");
      if (m_overrideNotSplit->getCheck())
        m_commandLineHandler->addOption("--ns");
      if (m_overrideInterleaved->getCheck())
        m_commandLineHandler->addOption("--int");
      if (m_overrideInterleaved2->getCheck())
        m_commandLineHandler->addOption("--int2");
      if (m_overrideNotInterleaved->getCheck())
        m_commandLineHandler->addOption("--nint");
    }
}
Beispiel #30
0
// Append entry
void FXReplaceDialog::appendHistory(const FXString& search,const FXString& replace,FXuint mode){
  register const char* val;
  register int i;
  if(!search.empty()){
    if(search!=getApp()->reg().readStringEntry(searchgroup,skey[0],FXString::null)){
      for(i=19; i>0; i--){
        if((val=getApp()->reg().readStringEntry(searchgroup,skey[i-1],NULL))!=NULL) getApp()->reg().writeStringEntry(searchgroup,skey[i],val);
        if((val=getApp()->reg().readStringEntry(searchgroup,rkey[i-1],NULL))!=NULL) getApp()->reg().writeStringEntry(searchgroup,rkey[i],val);
        if((val=getApp()->reg().readStringEntry(searchgroup,mkey[i-1],NULL))!=NULL) getApp()->reg().writeStringEntry(searchgroup,mkey[i],val);
        }
      }
    getApp()->reg().writeStringEntry(searchgroup,skey[0],search.text());
    getApp()->reg().writeStringEntry(searchgroup,rkey[0],replace.text());
    getApp()->reg().writeUnsignedEntry(searchgroup,mkey[0],mode);
    }
  }