NS_IMETHODIMP nsPrintOptions::InitPrintSettingsFromPrefs(nsIPrintSettings* aPS, PRBool aUsePNP, PRUint32 aFlags) { NS_ENSURE_ARG_POINTER(aPS); PRBool isInitialized; aPS->GetIsInitializedFromPrefs(&isInitialized); if (isInitialized) return NS_OK; nsAutoString prtName; // read any non printer specific prefs // with empty printer name nsresult rv = ReadPrefs(aPS, prtName, aFlags); NS_ENSURE_SUCCESS(rv, rv); // Get the Printer Name from the PrintSettings // to use as a prefix for Pref Names rv = GetAdjustedPrinterName(aPS, aUsePNP, prtName); NS_ENSURE_SUCCESS(rv, rv); if (prtName.IsEmpty()) { NS_WARNING("Caller should supply a printer name."); return NS_OK; } // Now read any printer specific prefs rv = ReadPrefs(aPS, prtName, aFlags); if (NS_SUCCEEDED(rv)) aPS->SetIsInitializedFromPrefs(PR_TRUE); return NS_OK; }
void TestOpenDocument( void ) { Err err; DocumentInfo docInfo; OS_Init(); ReadPrefs(); SetStandardFunctions(); DeleteMetaDocument( TEST_DOCUMENT, 0 ); StrCopy( docInfo.name, TEST_DOCUMENT ); docInfo.cardNo = 0; docInfo.size = 550; docInfo.created = -1139389298; docInfo.attributes = 512; docInfo.categories = 1; docInfo.location = 0; docInfo.active = true; docInfo.timestamp = 0; docInfo.volumeRef = 0; docInfo.numRecords = 0; err = OpenDocument( &docInfo ); ASSERT_MSG( "UnitTest.pdb must be installed", err == errNone ); CloseDocument(); OS_Release(); }
void TestPrefsDataReadOld( void ) { OldPreferences oldPref; Int16 version; UInt16 prefSize; /* Add known old preference structure */ MemSet( &oldPref, sizeof( OldPreferences ), 0 ); oldPref.rotate = true; oldPref.controlMode = MODE2; oldPref.useDateTime = true; PrefSetAppPreferences( (UInt32) ViewerAppID, (UInt16) ViewerOldPrefID, (Int16) ViewerVersion, &oldPref, sizeof( OldPreferences ), true ); /* When the old preference structure is found it should be converted to the new format and then the old structure should be removed */ ReadPrefs(); ASSERT( Prefs()->rotate ); ASSERT( Prefs()->controlMode == MODE2 ); ASSERT( Prefs()->useDateTime ); /* Check that the old preference structure is removed */ prefSize = 0; version = PrefGetAppPreferences( (UInt32) ViewerAppID, (UInt16) ViewerOldPrefID, NULL, &prefSize, true); ASSERT( version == noPreferenceFound ); }
void TestPrefsDataInit( void ) { /* Change a known item to make sure it is updated */ Prefs()->controlMode = MODE3; /* Since we don't have any preference structure calling ReadPrefs should create a new structure, i.e. the controlMode item should be set to its default value (MODE1) */ ReadPrefs(); ASSERT( Prefs()->controlMode == MODE1 ); }
void TestPrefsDataRead( void ) { Preferences testPref; /* Add known preference structure */ MemSet( &testPref, sizeof( Preferences ), 0 ); testPref.controlMode = MODE2; PrefSetAppPreferences( (UInt32) ViewerAppID, (UInt16) ViewerPrefID, (Int16) ViewerVersion, &testPref, sizeof( Preferences ), true ); /* Read it back and check that the item has the correct value */ ReadPrefs(); ASSERT( Prefs()->controlMode == MODE2 ); }
void JXSharedPrefObject::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == JXGetSharedPrefsManager() && message.Is(JXSharedPrefsManager::kRead)) { ReadPrefs(); } else { JBroadcaster::Receive(sender, message); } }
/* Open test document */ Err OpenTestDocument ( Char* name, DocumentInfo* docInfo ) { Err err = 1; UInt16 i; /* Find the data for the given document */ for ( i = 0; i < sizeof TestDocument / sizeof TestDocument[ 0 ]; i++ ) { PluckerDocument* document; document = &TestDocument[ i ]; if ( STREQ( name, document->name ) ) { OS_Init(); ReadPrefs(); SetStandardFunctions(); DeleteMetaDocument( document->name, 0 ); StrCopy( docInfo->name, document->name ); docInfo->cardNo = document->cardNo; docInfo->size = document->size; docInfo->created = document->created; docInfo->attributes = document->attributes; docInfo->categories = document->categories; docInfo->location = document->location; docInfo->active = document->active; docInfo->timestamp = document->timestamp; docInfo->volumeRef = document->volumeRef; docInfo->numRecords = document->numRecords; docInfo->filename = document->filename; err = OpenDocument( docInfo ); } } return err; }
bool WebP_InUI( WebP_InUI_Data *params, bool have_alpha, const void *plugHndl, const void *mwnd) { bool continue_reading = true; g_alpha = DIALOG_ALPHA_TRANSPARENCY; g_mult = false; g_autoD = false; ReadPrefs(); // check for that shift key bool shift_key = ( KeyIsDown(VK_LSHIFT) || KeyIsDown(VK_RSHIFT) || KeyIsDown(VK_LMENU) || KeyIsDown(VK_RMENU) ); if((g_autoD && have_alpha) || shift_key) { int status = DialogBox(hDllInstance, (LPSTR)"IN_DIALOG", (HWND)mwnd, (DLGPROC)DialogProc); if(g_item_clicked == IN_OK) { WriteAutoPrefs(); continue_reading = true; } else continue_reading = false; } params->alpha = g_alpha; params->mult = g_mult; return continue_reading; }
AvcCompressorDialog::AvcCompressorDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style ) : wxDialog( parent, id, title, position, size, style ), mctlAdjWin ( 0 ), mctlDelay ( 0 ), mctlChangeWin ( 0 ), mctlMinPct ( 0 ) { for ( int i = 0 ; i < NUM_CURVE_POINTS ; ++i ) { mctlCheckBoxes[i] = 0; mctlXAxis[i] = 0; mctlYAxis[i] = 0; } MakeAvcCompressorDialog( this, TRUE ); // First make sure all value initialized, especially horiz and vert first & last values wxCommandEvent event; OnRestoreDefaults(event); // Now read in from registry ReadPrefs(); }
int main(int argc, char *argv[]) { char *cdfile = NULL; char *ctfile = NULL; char *pofile = NULL; char *newctfile = NULL; char *catalog = NULL; char *source; char *template; int makenewct = FALSE; int makecatalog = FALSE; int i; if(argc == 0) /* Aztec's entry point for workbench programs */ { fprintf(stderr, "FlexCat can't be run from Workbench!\n" \ "\n" "Open a Shell session and type FlexCat ?\n" \ "for more information\n"); exit(5); } if(OpenLibs() == FALSE) exit(20); OpenFlexCatCatalog(); /* Big Endian vs. Little Endian (both supported ;-) */ if(!SwapChoose()) { fprintf(stderr, "FlexCat is unable to determine\n" \ "the byte order used by your system.\n" \ "It's neither Little nor Big Endian?!.\n"); exit(5); } #ifdef AMIGA ReadPrefs(); #endif if(argc == 1) { Usage(); } for(i = 1; i < argc; i++) { if(Strnicmp(argv[i], "catalog=", 8) == 0) { catalog = argv[i] + 8; makecatalog = TRUE; } else if(Stricmp(argv[i], "catalog") == 0) { if(i == argc - 1) { catalog = NULL; makecatalog = TRUE; } else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { catalog = argv[i + 1]; i++; makecatalog = TRUE; } else { catalog = NULL; makecatalog = TRUE; } } } else if(Strnicmp(argv[i], "pofile=", 7) == 0) { pofile = argv[i] + 7; } else if(Stricmp(argv[i], "pofile") == 0) { if(i == argc - 1) pofile = NULL; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { pofile = argv[i + 1]; i++; } else pofile = NULL; } } else if(Strnicmp(argv[i], "codeset=", 8) == 0) { strcpy(DestCodeset, argv[i] + 8); } else if(Stricmp(argv[i], "codeset") == 0) { if(i == argc - 1) DestCodeset[0] = '\0'; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { strcpy(DestCodeset, argv[i + 1]); i++; } else DestCodeset[0] = '\0'; } } else if(Strnicmp(argv[i], "version=", 8) == 0) { CatVersion = strtol(argv[i]+8, NULL, 10); } else if(Stricmp(argv[i], "version") == 0) { if(i == argc - 1) CatVersion = -1; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { CatVersion = strtol(argv[i + 1], NULL, 10); i++; } else CatVersion = -1; } } else if(Strnicmp(argv[i], "revision=", 9) == 0) { CatRevision = strtol(argv[i]+9, NULL, 10); } else if(Stricmp(argv[i], "revision") == 0) { if(i == argc - 1) CatRevision = -1; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { CatRevision = strtol(argv[i + 1], NULL, 10); i++; } else CatRevision = -1; } } else if(Stricmp(argv[i], "nooptim") == 0) { NoOptim = TRUE; } else if(Stricmp(argv[i], "fill") == 0) { Fill = TRUE; } else if(Stricmp(argv[i], "quiet") == 0) { Quiet = TRUE; } else if(Stricmp(argv[i], "flush") == 0) { DoExpunge = TRUE; } else if(Stricmp(argv[i], "nobeep") == 0) { NoBeep = TRUE; } else if(Stricmp(argv[i], "nobufferedio") == 0) { NoBufferedIO = TRUE; } else if(Strnicmp(argv[i], "newctfile=", 10) == 0) { newctfile = argv[i] + 10; makenewct = TRUE; } else if(Stricmp(argv[i], "newctfile") == 0) { if(i == argc - 1) { newctfile = NULL; makenewct = TRUE; } else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { newctfile = argv[i + 1]; i++; makenewct = TRUE; } else { newctfile = NULL; makenewct = TRUE; } } } else if(Stricmp(argv[i], "nolangtolower") == 0) { LANGToLower = FALSE; } else if(Stricmp(argv[i], "modified") == 0) { Modified = TRUE; } else if(Stricmp(argv[i], "warnctgaps") == 0) { WarnCTGaps = TRUE; } else if(Stricmp(argv[i], "copymsgnew") == 0) { CopyNEWs = TRUE; } else if(Stricmp(argv[i], "oldmsgnew") == 0) { snprintf(Old_Msg_New, sizeof(Old_Msg_New), "; %s", argv[++i]); } else if(Stricmp(argv[i], "noautodate") == 0 || Stricmp(argv[i], "nospaces") == 0) { // just swallow some no longer supported options to // keep old scripts alive and happy } else if(cdfile == NULL) { if(Stricmp(argv[i], "?") == 0 || Stricmp(argv[i], "-h") == 0 || Stricmp(argv[i], "help") == 0 || Stricmp(argv[i], "--help") == 0) { Usage(); } cdfile = argv[i]; // find out file extension and depending on it // we eiterh scan a CD file or the supplied pot file if(strstr(cdfile, ".pot") != NULL) { if(!ScanPOFile(cdfile, FALSE)) MyExit(10); } else { if(!ScanCDFile(cdfile)) MyExit(10); } } else if(strchr(argv[i], '=') != NULL) { /* Determine basename. */ if(BaseName == NULL && cdfile != NULL) { char *lslash = strrchr(cdfile, '/'); char *ldot = strrchr(cdfile, '.'); if(lslash == NULL) lslash = cdfile; else lslash++; if(ldot == NULL) ldot = cdfile + strlen(cdfile); if(ldot - lslash > 0) { BaseName = calloc(ldot - lslash + 3, 1); strncpy(BaseName, lslash, ldot - lslash); } } source =AllocString(argv[i]); template = strchr(source, '='); *template++ = '\0';
JARInsert::JARInsert(long host_buffer_size, int hostType) : c_error(kNoErr), c_client(NULL), c_isRunning(false), c_rBufOn(false), c_needsDeactivate(false), c_hBufferSize(host_buffer_size), c_hostType(hostType) { ReadPrefs(); UInt32 outSize; Boolean isWritable; if (!OpenAudioClient()) { JARILog("Cannot find jack client.\n"); SHOWALERT("Cannot find jack client for this application, check if Jack server is running."); return; } // Deactivate Jack callback //AudioDeviceGetPropertyInfo(c_jackDevID, 0, true, kAudioDevicePropertyDeactivateJack, &outSize, &isWritable); //AudioDeviceSetProperty(c_jackDevID, NULL, 0, true, kAudioDevicePropertyDeactivateJack, 0, NULL); int nPorts = 2; c_inPorts = (jack_port_t**)malloc(sizeof(jack_port_t*) * nPorts); c_outPorts = (float**)malloc(sizeof(float*) * nPorts); c_nInPorts = c_nOutPorts = nPorts; c_jBufferSize = jack_get_buffer_size(c_client); char name[256]; for (int i = 0;i < c_nInPorts;i++) { if (hostType == 'vst ') sprintf(name, "VSTreturn%d", JARInsert::c_instances + i + 1); else sprintf(name, "AUreturn%d", JARInsert::c_instances + i + 1); c_inPorts[i] = jack_port_register(c_client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); JARILog("Port: %s created\n", name); } c_instance = JARInsert::c_instances; for (int i = 0; i < c_nOutPorts; i++) { UInt32 portNum = c_instance + i; if (hostType == 'vst ') { AudioDeviceGetPropertyInfo(c_jackDevID, 0, true, kAudioDevicePropertyAllocateJackPortVST, &outSize, &isWritable); AudioDeviceSetProperty(c_jackDevID, NULL, 0, true, kAudioDevicePropertyAllocateJackPortVST, portNum, NULL); AudioDeviceGetPropertyInfo(c_jackDevID, 0, true, kAudioDevicePropertyGetJackPortVST, &outSize, &isWritable); AudioDeviceGetProperty(c_jackDevID, 0, true, kAudioDevicePropertyGetJackPortVST, &portNum, &c_outPorts[i]); } else { AudioDeviceGetPropertyInfo(c_jackDevID, 0, true, kAudioDevicePropertyAllocateJackPortAU, &outSize, &isWritable); AudioDeviceSetProperty(c_jackDevID, NULL, 0, true, kAudioDevicePropertyAllocateJackPortAU, portNum, NULL); AudioDeviceGetPropertyInfo(c_jackDevID, 0, true, kAudioDevicePropertyGetJackPortAU, &outSize, &isWritable); AudioDeviceGetProperty(c_jackDevID, 0, true, kAudioDevicePropertyGetJackPortAU, &portNum, &c_outPorts[i]); } JARILog("Port: %s created\n", name); } #if 0 if (!c_isRunning) { JARILog("Jack client activated\n"); jack_activate(c_client); c_needsDeactivate = true; } else c_needsDeactivate = false; #endif if (c_jBufferSize > c_hBufferSize) { c_bsAI1 = new BSizeAlign(c_hBufferSize, c_jBufferSize); c_bsAI2 = new BSizeAlign(c_hBufferSize, c_jBufferSize); c_bsAO1 = new BSizeAlign(c_jBufferSize, c_hBufferSize); c_bsAO2 = new BSizeAlign(c_jBufferSize, c_hBufferSize); if (c_bsAI1->Ready() && c_bsAI2->Ready() && c_bsAO1->Ready() && c_bsAO2->Ready()) { c_rBufOn = true; } else { c_error = kErrInvalidBSize; Flush(); return ; } } JARInsert::c_instances += 2; JARInsert::c_instances_count++; c_canProcess = true; // (Possible) reactivate Jack callback //AudioDeviceGetPropertyInfo(c_jackDevID, 0, true, kAudioDevicePropertyActivateJack, &outSize, &isWritable); //AudioDeviceSetProperty(c_jackDevID, NULL, 0, true, kAudioDevicePropertyActivateJack, 0, NULL); }