Exemplo n.º 1
0
USHORT SETTINGS :: VersionError (VOID)
{
    DisplayError (RSTR(IDS_HEADER_WARNING), RSTR(IDS_ERROR_INIFILEWRONGVERSION),
                  QueryProfileName ());
    SelectLanguage();
    return 0;
}
Exemplo n.º 2
0
BOOL Settings :: ReloadResources (PSZ psz)
{
    if (g_hmod)
        DosFreeModule(g_hmod);

    APIRET  rc;

    if ((rc = DosLoadModule(PSZ(NULL), 0, psz, &g_hmod)))
    {
        DisplayError("ERROR", "Could not (re)load Gotcha! resource module "
                     "'%s' (DosLoadModule() return code %d). First make sure the DLL is in the LIBPATH. If this is the case, try to delete "
                     "GOTCHA.INI and start Gotcha! again. If it does not work "
                     "then, contact the author ([email protected]).", psz, rc);
        exit(1);
    }

    ResourceString::Module(g_hmod);

    pszPageTab[0] = RSTR (IDS_PAGESAVE);
    pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
    pszPageTab[2] = RSTR (IDS_PAGEMISC);
    pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);

    for( int i = 0; i < BMF_INVALID; i++ ) {
        ifi[ i ].label = RSTR ( IDS_BITMAP12INTERNAL+i ); }

    return TRUE;
}
Exemplo n.º 3
0
USHORT SETTINGS :: FileNotOpenError (VOID)
{
    DisplayError (RSTR(IDS_HEADER_ERROR), RSTR(IDS_ERROR_INIFILENOTOPEN),
                  QueryProfileName ());
    SelectLanguage();
    return 0;
}
Exemplo n.º 4
0
//AVDictionary
JNIEXPORT jint JNICALL Java_au_notzed_jjmpeg_AVDictionaryNativeAbstract_set
(JNIEnv *env, jclass jc, jobject jptr, jstring jkey, jstring jvalue, jint flags) {
        AVDictionary *cptr = ADDR(jptr);
        const char * key = STR(jkey);
        const char * value = STR(jvalue);

        jint res = CALLDL(av_dict_set)(&cptr, key, value, flags);
        RSTR(jkey, key);
        RSTR(jvalue, value);
        return res;
}
Exemplo n.º 5
0
VOID Settings :: SelectLanguage (VOID)
{
    // set this to some default, as we must open the settings dialog for
    // selecting a language
    pszPageTab[0] = RSTR (IDS_PAGESAVE);
    pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
    pszPageTab[2] = RSTR (IDS_PAGEMISC);
    pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);

    // bring up the "select language" settings page
    Dialog (TRUE);
}
Exemplo n.º 6
0
static BOOL
ErrOptionSetTwice(PSTR pszOptName, UINT iArg)
{
   CHAR szErr[256];
   wsprintf(szErr,RSTR(OPTTWICE),pszOptName,iArg);
   Error(szErr);
   return Usage(FALSE);
}
Exemplo n.º 7
0
static BOOL
ArgError(PSTR pszErr, UINT iArg)
{
   CHAR szErr[256];
   wsprintf(szErr,RSTR(ARGERR),iArg);
   Error(szErr);
   return Usage(FALSE);
}
Exemplo n.º 8
0
static UINT
GetOutputOption(s_CLONEPARMS *parm, UINT iArg, BOOL gotDstFn)
{
   PSTR pszArg = Env_ParamStr(iArg);
   if (gotDstFn) return ErrOptionSetTwice(pszVOPTOUTPUT,iArg-1);
   if (!pszArg) return ArgError(RSTR(NOFILEN),iArg-1);
   String_Copy(parm->dstfn, pszArg, 1024);
   return (iArg+1);
}
Exemplo n.º 9
0
static UINT
GetEnlargeOption(s_CLONEPARMS *parm, UINT iArg)
{
   PSTR pszArg = Env_ParamStr(iArg);
   if (parm->flags & PARM_FLAG_ENLARGE) return ErrOptionSetTwice(pszVOPTENLARGE,iArg-1);
   if (!pszArg) return ArgError(RSTR(NODSIZE),iArg-1);
   String_Copy(parm->szDestSize, pszArg, 32);
   parm->flags |= PARM_FLAG_ENLARGE;
   return (iArg+1);
}
Exemplo n.º 10
0
JNIEXPORT  void JNICALL Java_au_notzed_jjmpeg_AVFormatContextNative_open
(JNIEnv *env, jclass jc, jobject jptr, jstring jfilename, jobject jfmt,  jobject options) {
        AVFormatContext *cptr = ADDR(jptr);
        const char * filename = STR(jfilename);
        AVInputFormat * fmt = ADDR(jfmt);
	AVDictionary * opts = ADDR(jptr);

        CALLDL(avformat_open_input)(&cptr, filename, fmt, &opts);
        RSTR(jfilename, filename);
}
Exemplo n.º 11
0
value_t module_loader_process_options(runtime_t *runtime, value_t self,
    value_t options) {
  CHECK_FAMILY(ofIdHashMap, options);
  value_t libraries = get_id_hash_map_at_with_default(options, RSTR(runtime, libraries),
      ROOT(runtime, empty_array));
  for (size_t i = 0; i < get_array_length(libraries); i++) {
    value_t library_path = get_array_at(libraries, i);
    TRY(module_loader_read_library(runtime, self, library_path));
  }
  return success();
}
Exemplo n.º 12
0
Helper :: Helper (HWND hwnd)
{
    HELPINIT   helpInit;

    // if we return because of an error, Help will be disabled
    fHelpEnabled = TRUE;

    // inititalize help init structure
    helpInit.cb                  = sizeof (HELPINIT);
    helpInit.ulReturnCode        = 0L;
    helpInit.pszTutorialName     = PSZ (NULL);
    helpInit.phtHelpTable        = PHELPTABLE (MAKELONG (MAIN_HELP_TABLE,
                                                         0xFFFF));
    helpInit.hmodHelpTableModule = GETMODULE;
    helpInit.hmodAccelActionBarModule = GETMODULE;
    helpInit.idAccelTable        = 0;
    helpInit.idActionBar         = 0;
    helpInit.pszHelpWindowTitle  = PSZ (PSZ_NAMEVERSION);
    helpInit.fShowPanelId        = CMIC_HIDE_PANEL_ID;

    CHAR   ach[_MAX_FNAME+_MAX_EXT];
    sprintf (ach, "%s.hlp", pset->QueryString (SEI_LANGUAGEHELP));
    helpInit.pszHelpLibraryName  = PSZ (ach);

    // create the help instance
    hwndHelpInstance = WinCreateHelpInstance (hab, &helpInit);
    if (!hwndHelpInstance || helpInit.ulReturnCode)
    {
        DisplayError (RSTR (IDS_ERROR_HELPERHEADING),
                      RSTR (IDS_ERROR_COULDNOTINITHELPFILE), ach);
        fHelpEnabled = FALSE;
    }

    // associate help instance with main frame
    if (! WinAssociateHelpInstance (hwndHelpInstance, hwnd))
    {
        DisplayError (RSTR (IDS_ERROR_HELPERHEADING),
                      RSTR (IDS_ERROR_COULDNOTINITHELP));
        fHelpEnabled = FALSE;
    }
}
Exemplo n.º 13
0
static BOOL
Error(PSTR sz)
{
   if (stderr) {
      File_WrBin(stderr,sz,lstrlen(sz));
      File_WrBin(stderr,"\r\n",2);
   } else {
      MessageBox(GetFocus(),sz,RSTR(ERROR),MB_ICONSTOP|MB_OK);
   }
   prog.bUserCancel = TRUE;
   return FALSE;
}
Exemplo n.º 14
0
static BOOL
Error(PSTR pszMsg)
{
   FILE stderr = GetStdHandle(STD_ERROR_HANDLE);
   if (stderr == NULLFILE) stderr = 0;
   if (stderr) {
      File_WrBin(stderr,pszMsg,lstrlen(pszMsg));
      File_WrBin(stderr,"\r\n",2);
   } else {
      MessageBox(GetFocus(), pszMsg, RSTR(ERROR), MB_ICONEXCLAMATION|MB_OK);
   }
   return FALSE;
}
Exemplo n.º 15
0
// Returns true iff the given identifier is $:core.
static bool is_present_core(runtime_t *runtime, value_t ident) {
  CHECK_FAMILY(ofIdentifier, ident);
  value_t path = get_identifier_path(ident);
  value_t stage = get_identifier_stage(ident);
  if (get_stage_offset_value(stage) != 0)
    // Not present.
    return false;
  if (is_path_empty(path) || !is_path_empty(get_path_tail(path)))
    // Not length 1.
    return false;
  value_t head = get_path_head(path);
  return value_identity_compare(head, RSTR(runtime, core));
}
Exemplo n.º 16
0
static BOOL
Usage(BOOL bShowBanner)
{
   FILE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
   if (stdout) {
      UINT ids;
      if (bShowBanner) {
         char sz[64];
         wsprintf(sz,RSTR(BANNER0),SOFTWARE_VERSION>>8,SOFTWARE_VERSION & 0xFF);
         File_WrBin(stdout, sz, lstrlen(sz));
         wsprintf(sz,RSTR(BANNER1),COPYRIGHT_YEAR);
         File_WrBin(stdout, sz, lstrlen(sz));
         wsprintf(sz,RSTR(BANNER2));
         File_WrBin(stdout, sz, lstrlen(sz));
      }
      for (ids=IDS_USAGE00; ids<=IDS_USAGE_LAST; ids++) {
         PSTR pszUsage = NULL;
         Env_LoadString(&pszUsage, ids);
         File_WrBin(stdout, pszUsage, lstrlen(pszUsage));
      }
   }
   return FALSE;
}
Exemplo n.º 17
0
rb_encoding_t *
rb_enc_get(VALUE obj)
{
    switch (TYPE(obj)) {
	case T_STRING:
	    if (IS_RSTR(obj)) {
		return RSTR(obj)->encoding;
	    }
	    return rb_encodings[ENCODING_UTF8];

	case T_SYMBOL:
	    return rb_enc_get(rb_sym_str(obj));
    }
    return NULL;
}
Exemplo n.º 18
0
void* RAPIloopback(void *query) {
	res_table* output = NULL;
	char* querystr = (char*)CHAR(STRING_ELT(query, 0));
	char* err = SQLstatementIntern(rapiClient, &querystr, "name", 1, 0, &output);

	if (err) { // there was an error
		return ScalarString(RSTR(err));
	}
	if (output) {
		int ncols = output->nr_cols;
		if (ncols > 0) {
			int i;
			SEXP retlist, names, varvalue = R_NilValue;
			retlist = PROTECT(allocVector(VECSXP, ncols));
			names = PROTECT(NEW_STRING(ncols));
			for (i = 0; i < ncols; i++) {
				BAT *b = BATdescriptor(output->cols[i].b);
				if (b == NULL || !(varvalue = bat_to_sexp(b, TYPE_any))) {
					UNPROTECT(i + 3);
					if (b)
						BBPunfix(b->batCacheid);
					return ScalarString(RSTR("Conversion error"));
				}
				BBPunfix(b->batCacheid);
				SET_STRING_ELT(names, i, RSTR(output->cols[i].name));
				SET_VECTOR_ELT(retlist, i, varvalue);
			}
			res_table_destroy(output);
			SET_NAMES(retlist, names);
			UNPROTECT(ncols + 2);
			return retlist;
		}
		res_table_destroy(output);
	}
	return ScalarLogical(1);
}
Exemplo n.º 19
0
VOID STATD :: Finished (VOID)
{
    fFinished = TRUE;

    if (! hwndDlg)
        return;

    WinSetWindowText (WinWindowFromID (hwndDlg, WID_PB_OK),
#ifdef _MULTILANGUAGES_
                      RSTR (IDS_OK));
#else
                      "Ok");
#endif
    if (fInstantQuit)
        WinPostMsg (hwndDlg, WM_CLOSE, 0,0);
}
Exemplo n.º 20
0
JNIEXPORT jobject JNICALL Java_au_notzed_jjmpeg_AVIOContextNative_open
(JNIEnv *env, jclass jc, jstring jurl, int flags, jobject jerror_buf) {
	const char *url = STR(jurl);
	AVIOContext *context = NULL;
	int *resp = ADDR(jerror_buf);
	jobject res = NULL;

	resp[0] = CALLDL(avio_open)(&context, url, flags);

	if (resp[0] == 0) {
		res = WRAP(context, sizeof(*context));
	}

	RSTR(jurl, url);

	return res;
}
Exemplo n.º 21
0
JNIEXPORT jobject JNICALL Java_au_notzed_jjmpeg_AVIOContextNative_probeInput
(JNIEnv *env, jclass jc, jobject jpb, jstring jname, jint offset, jint max_probe_size) {
	AVIOContext *pb = ADDR(jpb);
	const char *name = STR(jname);
	//int *resp = ADDR(jerror_buf);
	AVInputFormat *fmt = NULL;
	jobject res = NULL;

	//resp[0]
	int ret = CALLDL(av_probe_input_buffer)(pb, &fmt, name, NULL, offset, max_probe_size);
	d(printf("probe input buffer = %d\n", ret));

	if (ret == 0) {
		res = WRAP(fmt, sizeof(*fmt));
	}

	RSTR(jname, name);

	return res;
}
Exemplo n.º 22
0
str RAPIprelude(void *ret) {
	(void) ret;

	if (RAPIEnabled()) {
		MT_lock_set(&rapiLock);
		/* startup internal R environment  */
		if (!rapiInitialized) {
			char *initstatus;
			initstatus = RAPIinitialize();
			if (initstatus != 0) {
				MT_lock_unset(&rapiLock);
				throw(MAL, "rapi.eval",
					  "failed to initialize R environment (%s)", initstatus);
			}
			Rf_defineVar(Rf_install("MONETDB_LIBDIR"), ScalarString(RSTR(LIBDIR)), R_GlobalEnv);

		}
		MT_lock_unset(&rapiLock);
		printf("# MonetDB/R   module loaded\n");
	}
	return MAL_SUCCEED;
}
Exemplo n.º 23
0
VOID STATD :: Advance (PSZ psz)
{
    c ++;

    if (! hwndDlg)
        return;

    CHAR   ach[21];
#ifdef _MULTILANGUAGES_
    sprintf (ach, RSTR (IDS_XOFX), c, cMax);
#else
    sprintf (ach, "%ld of %ld", c, cMax);
#endif
    WinSetWindowText (WinWindowFromID (hwndDlg, WID_ST_COUNT), ach);

    WinSetWindowText (WinWindowFromID (hwndDlg, WID_E_FILE), psz);

    WinSendDlgItemMsg (hwndDlg, WID_S_PROGRESS, SLM_SETSLIDERINFO,
                       MPFROM2SHORT (SMA_SLIDERARMPOSITION,
                                     SMA_INCREMENTVALUE),
                       MPFROMLONG ((c*100L)/cMax));
}
Exemplo n.º 24
0
// For UTF-[8, 16, 32] it's /uFFFD, and for others it's '?'
rb_str_t *replacement_string_for_encoding(rb_encoding_t* destination)
{
    rb_str_t *replacement_str = NULL;
    if (destination == rb_encodings[ENCODING_UTF16BE]) {
        replacement_str = RSTR(rb_enc_str_new("\xFF\xFD", 2, destination));
    }
    else if (destination == rb_encodings[ENCODING_UTF32BE]) {
        replacement_str = RSTR(rb_enc_str_new("\0\0\xFF\xFD", 4, destination));
    }
    else if (destination == rb_encodings[ENCODING_UTF16LE]) {
        replacement_str = RSTR(rb_enc_str_new("\xFD\xFF", 2, destination));
    }
    else if (destination == rb_encodings[ENCODING_UTF32LE]) {
        replacement_str = RSTR(rb_enc_str_new("\xFD\xFF\0\0", 4, destination));
    }
    else if (destination == rb_encodings[ENCODING_UTF8]) {
        replacement_str = RSTR(rb_enc_str_new("\xEF\xBF\xBD", 3, destination));
    }
    else {
        replacement_str = RSTR(rb_enc_str_new("?", 1, rb_encodings[ENCODING_ASCII]));
        replacement_str = str_simple_transcode(replacement_str, destination);
    }
    return replacement_str;
}
Exemplo n.º 25
0
VOID MP3DISPLAY :: RenameAll (VOID)
{
#ifdef _DEBUGLOG_
    fputs ("\nRenameAll ()\n", pfileLog);
#endif

    if (! hwnd || ! FilesInList ())
        return;

/*    // confirm operation
    if (WinMessageBox (HWND_DESKTOP, hwnd,
#ifdef _MULTILANGUAGES_
                       RSTR (IDS_REALLYRENAMEALL),
                       RSTR (IDS_REALLYRENAMEALLHEADING),
#else
                       "Rename all files (with tag) to their Title?",
                       "REALLY RENAME?",
#endif
                       0L,
                       MB_OKCANCEL | MB_QUERY | MB_DEFBUTTON2 | MB_MOVEABLE)
        != MBID_OK)
        return; */

    if (QueryMP3 ())
    {
        delete QueryMP3 ();
        SetMP3 (NULL);
    }

    // set mouse-ptr to "wait" shape
    HPOINTER   hptr = WinQueryPointer (HWND_DESKTOP);
    WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_WAIT,
                                                     FALSE));
    // do the thing
    CHAR    ach[_MAX_PATH], ach2[_MAX_PATH+31];
    ULONG   c = 0L;

    // FIXME perhaps ... = strlen ("Filename");
    plist->usMaxLen[TAG_FILENAME] = 0;

    for (ULONG i = 0; i < CountFilesInList (); i++)
    {
        QueryFile (ach, sizeof (ach), i);

        if ((pmp3 = new MP3 (ach)))
        {
//            if (pmp3->IsTagged ())
            {
#ifdef _MULTILANGUAGES_
                sprintf (ach2, RSTR (IDS_RENAMINGFORMAT), ach);
#else
                sprintf (ach2, "Renaming - %s", ach);
#endif
                WinSetWindowText (hwnd, ach2);

                USHORT  cb = GETSETTINGS->QueryLong (SEI_RENAMELENGTH);
                if (! GETSETTINGS->QueryFlag (SEI_RENAMELIMITLENGTH))
                    cb = 0;
                if (pren->Rename (pmp3,
                            GETSETTINGS->QueryString (SEI_RENAMETEMPLATE),
                            GETSETTINGS->QueryFlag (SEI_RENAMEREPLACESPACES),
                            cb))
                {
                    c ++;
                    strcpy (ach2, pmp3->QueryFilename ().c_str ());
                    WinSetLboxItemText (WinWindowFromID (hwnd, WID_DDL_FILES),
                                        i, ach2);
                    WinSendDlgItemMsg (hwnd, WID_DDL_FILES, EM_SETFIRSTCHAR,
                                       0L, 0L);
                    // if this MP3's filename is longer than current maximum
                    // in list adjust maximum (needed for outputing lists)
                    plist->usMaxLen[TAG_FILENAME] =
                        max (plist->usMaxLen[TAG_FILENAME],
                             USHORT (strlen (pmp3->QueryFilename ().c_str ())));
                }
                else
                {
#ifdef _MULTILANGUAGES_
                    DisplayError (RSTR (IDS_ERROR_GENERALHEADING),
                                  RSTR (IDS_ERROR_RENAMINGFAILED),
                                  ach, errno);
#else
                    DisplayError ("ERROR", "Renaming file '%s' failed: "
                                  "Error %d.", ach, errno);
#endif
                    plist->usMaxLen[TAG_FILENAME] =
                        max (plist->usMaxLen[TAG_FILENAME],
                             USHORT (strlen (ach)));
                }
            }
            delete pmp3;
        }
    }

    if (pset->NotifyRename ())
    {
#ifdef _MULTILANGUAGES_
        // tell user what has been done
        if (c < CountFilesInList ())
            Notify (RSTR (IDS_FILESRENAMEDHEADING),
                    RSTR (IDS_SOMEFILESRENAMED), c);
        else
            Notify (RSTR (IDS_FILESRENAMEDHEADING),
                    RSTR (IDS_ALLFILESRENAMED));
#else
        // tell user what has been done
        if (c < CountFilesInList ())
            Notify ("SOME FILES RENAMED",
                    "%ld selected files have been renamed (The "
                    "others probably had no tag)", c);
        else
            Notify ("ALL FILES SAVED",
                    "All selected files have been renamed.");
#endif
    }

    // reload the current file and refresh the display
    SetMP3 (NULL);
    Refresh ();

    QueryFile (ach, sizeof (ach));
    WinSetWindowText (WinWindowFromID (hwnd, WID_DDL_FILES), ach);

    // set mouse-ptr to normal shape
    WinSetPointer (HWND_DESKTOP, hptr);
    WinSetWindowText (hwnd, PSZ_NAMEVERSION);
}
Exemplo n.º 26
0
VOID MP3DISPLAY :: RemoveAll (VOID)
{
#ifdef _DEBUGLOG_
    fputs ("\nRemoveAll ()\n", pfileLog);
#endif

    if (! hwnd || ! FilesInList ())
        return;

    // confirm operation
    if (WinMessageBox (HWND_DESKTOP, hwnd,
#ifdef _MULTILANGUAGES_
                       RSTR (IDS_REALLYREMOVETAGS),
                       RSTR (IDS_REALLYREMOVETAGSHEADING),
#else
                       "Really remove the tags of all selected files?",
                       "REALLY REMOVE?",
#endif
                       0L,
                       MB_OKCANCEL | MB_QUERY | MB_DEFBUTTON2 | MB_MOVEABLE)
        != MBID_OK)
        return;

    if (QueryMP3 ())
    {
        delete QueryMP3 ();
        SetMP3 (NULL);
    }

    // set mouse-ptr to "wait" shape
    HPOINTER   hptr = WinQueryPointer (HWND_DESKTOP);
    WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_WAIT,
                                                     FALSE));

    // do the thing
    CHAR    ach[_MAX_PATH], ach2[_MAX_PATH+31];
    ULONG   c = 0L;

    for (ULONG i = 0; i < CountFilesInList (); i++)
    {
        QueryFile (ach, sizeof (ach), i);

        if ((pmp3 = new MP3 (ach)))
        {
            if (pmp3->IsTagged ())
            {
#ifdef _MULTILANGUAGES_
                sprintf (ach2, RSTR (IDS_REMOVINGFORMAT), ach);
#else
                sprintf (ach2, "Removing - %s", ach);
#endif
                if (pmp3->RemoveTag ())
                    c++;
            }
            else
#ifdef _MULTILANGUAGES_
                sprintf (ach2, RSTR (IDS_IGNORINGFORMAT), ach);
#else
                sprintf (ach2, "Ignoring - %s", ach);
#endif
            delete pmp3;
        }

        WinSetWindowText (hwnd, ach2);
    }

    if (pset->NotifyRemove ())
    {
#ifdef _MULTILANGUAGES_
        // tell user what has been done
        if (c < CountFilesInList ())
            Notify (RSTR (IDS_TAGSREMOVEDHEADING),
                    RSTR (IDS_SOMETAGSREMOVED), c);
        else
            Notify (RSTR (IDS_TAGSREMOVEDHEADING),
                    RSTR (IDS_ALLTAGSREMOVED));
#else
        // tell user what has been done
        if (c < CountFilesInList ())
            Notify ("SOME TAGS REMOVED",
                    "Tags have been removed from %ld selected files (The "
                    "others probably were read only or had no tag)", c);
        else
            Notify ("ALL TAGS REMOVED",
                    "Tags have been removed from all selected files.");
#endif
    }

    // reload the current file and refresh the display
    SetMP3 (NULL);
    Refresh ();

    // set mouse-ptr to normal shape
    WinSetPointer (HWND_DESKTOP, hptr);
    WinSetWindowText (hwnd, PSZ_NAMEVERSION);
}
Exemplo n.º 27
0
PUBLIC BOOL
CmdLine_Parse(s_CLONEPARMS *parm)
{
   BOOL gotSrcFn=FALSE,gotDstFn=FALSE;
   PSTR pszArg;
   UINT argc = Env_ParamCount();
   UINT iArg = 1;

   ZeroMemory(parm,sizeof(s_CLONEPARMS));
   parm->flags = PARM_FLAG_CLIMODE;

   while (iArg <= argc) {
      pszArg = Env_ParamStr(iArg);
      if (!pszArg) break; // can't happen.
      
      iArg++;
      if (pszArg[0]=='-') { // if option
         if (pszArg[1]=='-') {
            // verbose options
            char szItem[32];
            pszArg+=2;
            for (;;) {
               pszArg = VerboseSubOption(szItem,32,pszArg);
               if (szItem[0]==0) break;
               if (String_Compare(szItem,pszVOPTHELP)==0) {
                  return Usage(TRUE);
               } else if  (String_Compare(szItem,pszVOPTOUTPUT)==0) {
                  iArg = GetOutputOption(parm,iArg,gotDstFn);
                  if (iArg==0) return FALSE;
                  gotDstFn = TRUE;
               } else if  (String_Compare(szItem,pszVOPTKEEPUUID)==0) {
                  if (!GetOption(parm,iArg,PARM_FLAG_KEEPUUID,pszVOPTKEEPUUID)) return FALSE;
               } else if  (String_Compare(szItem,pszVOPTCOMPACT)==0) {
                  if (!GetOption(parm,iArg,PARM_FLAG_COMPACT,pszVOPTCOMPACT)) return FALSE;
               } else if  (String_Compare(szItem,pszVOPTNOMERGE)==0) {
                  if (!GetOption(parm,iArg,PARM_FLAG_NOMERGE,pszVOPTNOMERGE)) return FALSE;
               } else if  (String_Compare(szItem,pszVOPTREPART)==0) {
                  if (!GetOption(parm,iArg,PARM_FLAG_REPART,pszVOPTREPART)) return FALSE;
               } else if  (String_Compare(szItem,pszVOPTENLARGE)==0) {
                  iArg = GetEnlargeOption(parm,iArg);
                  if (iArg==0) return FALSE;
               } else {
                  return ArgError(RSTR(UNKOPT),iArg-1);
               }
            }
         } else {
            // single char options.
            CHAR c;
            pszArg++;
            c = *pszArg++;
            if (!c) return ArgError(RSTR(INVOPT),iArg-1);
            while (c) {
               if (c==pszCHAROPT[4]) { // 'h'
                  return Usage(TRUE);
               } else if (c==pszCHAROPT[0]) { // 'o'
                  iArg = GetOutputOption(parm,iArg,gotDstFn);
                  if (iArg==0) return FALSE;
                  gotDstFn = TRUE;
               } else if (c==pszCHAROPT[1]) { // 'k'
                  if (!GetOption(parm,iArg,PARM_FLAG_KEEPUUID,pszVOPTKEEPUUID)) return FALSE;
               } else if (c==pszCHAROPT[3]) { // 'c'
                  if (!GetOption(parm,iArg,PARM_FLAG_COMPACT,pszVOPTCOMPACT)) return FALSE;
               } else if (c==pszCHAROPT[5]) { // 'r'
                  if (!GetOption(parm,iArg,PARM_FLAG_REPART,pszVOPTREPART)) return FALSE;
               } else if (c==pszCHAROPT[2]) { // 'e'
                  iArg = GetEnlargeOption(parm,iArg);
                  if (iArg==0) return FALSE;
               } else {
                  return ArgError(RSTR(UNKOPT),iArg-1);
               }
               c = *pszArg++;
            }
         }
      } else if (gotSrcFn) {
         return ArgError(RSTR(SRCTWICE),iArg-1);
      } else {
         GetFullPathName(pszArg,1024,parm->srcfn,0);
         gotSrcFn = TRUE;
      }
   }
   if (!gotSrcFn) {
      return ArgError(RSTR(NEEDSRC),iArg-1);
   }
   if (!gotDstFn) {
      Env_GenerateCloneName(parm->dstfn,parm->srcfn);
   }
   GetFullPathName(parm->dstfn,1024,tmpfn,0);
   String_Copy(parm->dstfn, tmpfn, 1024);

   if (!(parm->flags & PARM_FLAG_ENLARGE)) parm->flags &= ~PARM_FLAG_REPART;

   return TRUE;
}
Exemplo n.º 28
0
VOID MP3DISPLAY :: SaveAll (VOID)
{
#ifdef _DEBUGLOG_
    fputs ("\nSaveAll ()\n", pfileLog);
#endif

    if (! hwnd || ! FilesInList ())
        return;

    // confirm operation
    if (WinMessageBox (HWND_DESKTOP, hwnd,
#ifdef _MULTILANGUAGES_
                       RSTR (IDS_REALLYSAVETAGS),
                       RSTR (IDS_REALLYSAVETAGSHEADING),
#else
                       "Attach the current tag to all selected files?",
                       "REALLY SAVE?",
#endif
                       0L,
                       MB_OKCANCEL | MB_QUERY | MB_DEFBUTTON2 | MB_MOVEABLE)
        != MBID_OK)
        return;

    if (QueryMP3 ())
    {
        delete QueryMP3 ();
        SetMP3 (NULL);
    }

    // set mouse-ptr to "wait" shape
    HPOINTER   hptr = WinQueryPointer (HWND_DESKTOP);
    WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_WAIT,
                                                     FALSE));
    // do the thing
    ULONG   c = 0L;

#ifdef _STATUSDISPLAY_
    pstatd = new STATD (
#ifdef _MULTILANGUAGES_
                        RSTR (IDS_SAVEALL),
#else
                        "Save all",
#endif
                        CountFilesInList (), hwnd, FALSE, &fBreak);
    pc     = &c;
    fBreak = FALSE;

    _beginthread (SaveAllThread, NULL, 32L*1024L, this);

    pstatd->Process ();

    delete pstatd;
#else
    CHAR   ach[_MAX_PATH];
    CHAR   ach2[_MAX_PATH+31];

    for (ULONG i = 0; i < CountFilesInList (); i++)
    {
        QueryFile (ach, sizeof (ach), i);

        if ((pmp3 = new MP3 (ach)))
        {
#ifdef _MULTILANGUAGES_
            sprintf (ach2, RSTR (IDS_SAVINGFORMAT), ach);
#else
            sprintf (ach2, "Saving - %s", ach);
#endif
            AdjustCurrent (FALSE);
            if (QueryMP3 ()->SaveTag ())
                c++;
            delete pmp3;
        }
        WinSetWindowText (hwnd, ach2);
    }
#endif

    if (pset->NotifySave ())
    {
#ifdef _MULTILANGUAGES_
        // tell user what has been done
        if (c < CountFilesInList ())
            Notify (RSTR (IDS_TAGSSAVEDHEADING),
                    RSTR (IDS_SOMETAGSSAVED), c);
        else
            Notify (RSTR (IDS_TAGSSAVEDHEADING),
                    RSTR (IDS_ALLTAGSSAVED));
#else
        // tell user what has been done
        if (c < CountFilesInList ())
            Notify ("SOME TAGS SAVED",
                    "Tags have been saved for %ld selected files (The "
                    "others probably were read only)", c);
        else
            Notify ("ALL TAGS SAVED",
                    "Tags have been saved for all selected files.");
#endif
    }

    // reload the current file and refresh the display
    SetMP3 (NULL);
    Refresh ();

    // set mouse-ptr to normal shape
    WinSetPointer (HWND_DESKTOP, hptr);
#ifndef _STATUSDISPLAY_
    WinSetWindowText (hwnd, PSZ_NAMEVERSION);
#endif
}