void XAP_UnixDialog_FileOpenSaveAs::fileTypeChanged(GtkWidget * w) { if (!m_bSave) return; UT_sint32 nFileType = XAP_comboBoxGetActiveInt(GTK_COMBO_BOX(w)); UT_DEBUGMSG(("File type widget is %p filetype number is %d \n",w,nFileType)); // I have no idea for 0, but XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO // definitely means "skip this" if((nFileType == 0) || (nFileType == XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO)) { return; } gchar * filename = gtk_file_chooser_get_filename(m_FC); UT_String sFileName = filename; FREEP(filename); UT_String sSuffix = m_szSuffixes[nFileType-1]; sSuffix = sSuffix.substr(1,sSuffix.length()-1); UT_sint32 i = 0; bool bFoundComma = false; for(i=0; i< static_cast<UT_sint32>(sSuffix.length()); i++) { if(sSuffix[i] == ';') { bFoundComma = true; break; } } if(bFoundComma) { sSuffix = sSuffix.substr(0,i); } // // Hard code a suffix // if(strstr(sSuffix.c_str(),"gz") != NULL) { sSuffix = ".zabw"; } bool bFoundSuffix = false; for(i= sFileName.length()-1; i> 0; i--) { if(sFileName[i] == '.') { bFoundSuffix = true; break; } } if(!bFoundSuffix) { return; } sFileName = sFileName.substr(0,i); sFileName += sSuffix; gtk_file_chooser_set_current_name(m_FC, UT_basename(sFileName.c_str())); }
int UT_Compare( const UT_String& rhs, const UT_String& lhs ) { #if defined(TARGET_IOS) || defined(TARGET_MACOS) CFStringRef theString1 = CFStringCreateWithCharactersNoCopy( 0, rhs.data(), rhs.length(), kCFAllocatorNull ); CFStringRef theString2 = CFStringCreateWithCharactersNoCopy( 0, lhs.data(), lhs.length(), kCFAllocatorNull ); CFComparisonResult result = CFStringCompare( theString1, theString2, kCFCompareLocalized ); CFRelease( theString1 ); CFRelease( theString2 ); return result; #else return rhs.compare(lhs); #endif }
//======================== METHOD DECLARATION ======================= // METHOD NAME : UT_W2S //--------------------------------------------------------------------- /// \param src /// \param dst /// \return //--------------------------------------------------------------------- // DESCRIPTION : /// Convert a 'wstring' to a string. //===================================================================== void UT_W2S( const UT_String &src, string &dst ) { #if defined(TARGET_IOS) || defined(TARGET_MACOS) CFStringRef strref = CFStringCreateWithCharactersNoCopy( 0, src.data(), src.length(), kCFAllocatorNull ); CFIndex usedBufLen; CFStringGetBytes( strref, CFRangeMake( 0, src.length() ), CFStringGetSystemEncoding(), '?', false, NULL, 0, &usedBufLen ); char *buffer = (char*)MEM_ALLOC(usedBufLen * sizeof(char)); CFStringGetBytes( strref, CFRangeMake( 0, src.length() ), CFStringGetSystemEncoding(), '?', false, (UInt8 *) buffer, usedBufLen, &usedBufLen ); CFRelease( strref ); dst.assign( buffer, usedBufLen ); MEM_DEALLOC(buffer); if ( ! dst.empty() ) dst.erase(dst.begin(), dst.end()); copy( src.begin(), src.end(), back_inserter( dst )); #else #ifndef TARGET_WIN32 dst = string(); if (src.length() < 1) { return; } unsigned char *dstC = (unsigned char*)MEM_ALLOC(6 * src.length() * sizeof(unsigned char)); unsigned char *initial = dstC; UTF16 *srcC = const_cast<UTF16*>(src.c_str()); ConvertUTF16toUTF8(&srcC, srcC + src.length(), &dstC, dstC + 6 * src.length()); dst.append((const char *)dstC); MEM_DEALLOC(initial); #else // TARGET_WIN32 (void)src; (void)dst; #endif #endif }
/** * Takes a string like "./ObjectReplacements/Object 1" and split it into * subdirectory name ("ObjectReplacements") and file name ("Object 1"). */ void ODi_Abi_Data::_splitDirectoryAndFileName(const gchar* pHRef, UT_String& dirName, UT_String& fileName) const { UT_String href; UT_String str; int iStart, nChars, i, len; href = pHRef; //// // Get the directory name str = href.substr(0, 2); if (str == "./") { iStart = 2; } else { iStart = 0; } len = href.length(); for (i=iStart, nChars=0; i<len; i++) { if (href[i] == '/') { i=len; // exit loop } else { nChars++; } } UT_ASSERT (nChars > 0 && nChars < len); dirName = href.substr(iStart, nChars); //// // Get the file name iStart = iStart + nChars + 1; nChars = len - iStart; UT_ASSERT (nChars); // The file name must have at least one char. fileName = href.substr(iStart, nChars); }
bool XAP_Win32AppImpl::openURL(const char * szURL) { // NOTE: could get finer control over browser window via DDE // NOTE: may need to fallback to WinExec for old NSCP versions UT_String sURL = szURL; // If this is a file:// URL, strip off file:// and make it backslashed if (sURL.substr(0, 7) == "file://") { sURL = sURL.substr(7, sURL.size() - 7); // View as WebPage likes to throw in an extra /\ just for fun, strip it off if (sURL.substr(0, 2) == "/\\") sURL = sURL.substr(2, sURL.size() - 2); if (sURL.substr(0, 1) == "/") sURL = sURL.substr(1, sURL.size() - 1); // Convert all forwardslashes to backslashes for (unsigned int i=0; i<sURL.length();i++) if (sURL[i]=='/') sURL[i]='\\'; // Convert from longpath to 8.3 shortpath, in case of spaces in the path char* longpath = NULL; char* shortpath = NULL; longpath = new char[PATH_MAX]; shortpath = new char[PATH_MAX]; strcpy(longpath, sURL.c_str()); DWORD retval = GetShortPathName(longpath, shortpath, PATH_MAX); if((retval == 0) || (retval > PATH_MAX)) { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); DELETEP(longpath); DELETEP(shortpath); return false; } sURL = shortpath; DELETEP(longpath); DELETEP(shortpath); } // Query the registry for the default browser so we can directly invoke it UT_String sBrowser; HKEY hKey; unsigned long lType; DWORD dwSize; unsigned char* szValue = NULL; if (RegOpenKeyEx(HKEY_CLASSES_ROOT, "http\\shell\\open\\command", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { if(RegQueryValueEx(hKey, NULL, NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS) { szValue = new unsigned char[dwSize + 1]; RegQueryValueEx(hKey, NULL, NULL, &lType, szValue, &dwSize); sBrowser = (char*) szValue; DELETEP(szValue); } RegCloseKey(hKey); } /* Now that we have sBrowser from the registry, we need to parse it out. * If the first character is a double-quote, everything up to and including * the next double-quote is the sBrowser command. Everything after the * double-quote is appended to the parameters. * If the first character is NOT a double-quote, we assume * everything up to the first whitespace is the command and anything after * is appended to the parameters. */ int iDelimiter; if (sBrowser.substr(0, 1) == "\"") iDelimiter = UT_String_findCh(sBrowser.substr(1, sBrowser.length()-1), '"')+2; else iDelimiter = UT_String_findCh(sBrowser.substr(0, sBrowser.length()), ' '); // Store params into a separate UT_String before we butcher sBrowser UT_String sParams = sBrowser.substr(iDelimiter+1, sBrowser.length()-iDelimiter+1); // Cut params off of sBrowser so all we're left with is the broweser path & executable sBrowser = sBrowser.substr(0, iDelimiter); // Check for a %1 passed in from the registry. If we find it, // substitute our URL for %1. Otherwise, just append sURL to params. const char *pdest = strstr(sParams.c_str(), "%1"); if (pdest != NULL) { int i = pdest - sParams.c_str() + 1; sParams = sParams.substr(0, i-1) + sURL + sParams.substr(i+1, sParams.length()-i+1); } else { sParams = sParams + " " + sURL; } // Win95 doesn't like the Browser command to be quoted, so strip em off. if (sBrowser.substr(0, 1) == "\"") sBrowser = sBrowser.substr(1, sBrowser.length() - 1); if (sBrowser.substr(sBrowser.length()-1, 1) == "\"") sBrowser = sBrowser.substr(0, sBrowser.length() - 1); XAP_Frame * pFrame = XAP_App::getApp()->getLastFocussedFrame(); UT_return_val_if_fail(pFrame, false); XAP_Win32FrameImpl *pFImp = (XAP_Win32FrameImpl *) pFrame->getFrameImpl(); UT_return_val_if_fail(pFImp, false); intptr_t res = (intptr_t) ShellExecuteA(pFImp->getTopLevelWindow() /*(HWND)*/, "open", sBrowser.c_str(), sParams.c_str(), NULL, SW_SHOW ); // TODO: localized error messages // added more specific error messages as documented in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp if (res <= 32) { UT_String errMsg; switch (res) { case ERROR_FILE_NOT_FOUND: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res); errMsg += ") displaying URL: The system cannot find the file specified.\n"; errMsg += " [ "; errMsg += sURL; errMsg += " ] "; MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION); } break; case ERROR_PATH_NOT_FOUND: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res); errMsg += ") displaying URL: The system cannot find the path specified.\n"; errMsg += " [ "; errMsg += sURL; errMsg += " ] "; MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION); } break; case SE_ERR_ACCESSDENIED: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res); errMsg += ") displaying URL: Access is denied.\n"; errMsg += " [ "; errMsg += sURL; errMsg += " ] "; MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION); } break; default: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res); errMsg += ") displaying URL: \n"; errMsg += " [ "; errMsg += sURL; errMsg += " ] "; MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION); } break; } /* switch (res) */ } /* if (res <= 32) */ return (res>32); }
#include "tf_test.h" #include "ut_string_class.h" #define TFSUITE "core.af.util.stringclass" TFTEST_MAIN("UT_String") { UT_String s("foobar"); TFPASS(s.size() == 6); TFPASS(s.length() == 6); TFFAIL(s.empty()); TFPASS(s == "foobar"); TFPASS(s == UT_String("foobar")); s += "baz"; TFPASS(s.size() == 9); TFPASS(s == "foobarbaz"); s += UT_String("42"); TFPASS(s.size() == 11); TFPASS(s == "foobarbaz42"); s += '!'; TFPASS(s.size() == 12); TFPASS(s == "foobarbaz42!"); TFPASS(s[3] == 'b');
OP_ERROR SOP_IdBlast::cookMySop(OP_Context &context) { fpreal now; exint id; GA_Offset start, end; GA_PointGroup *group; GA_ROAttributeRef id_gah; GA_ROPageHandleI id_ph; UT_String pattern; UT_WorkArgs tokens; IdOffsetMap id_map, srcid_map; GroupIdMapPair pair; now = context.getTime(); if (lockInputs(context) >= UT_ERROR_ABORT) return error(); // Duplicate the incoming geometry. duplicateSource(0, context); // Get the id pattern. IDS(pattern, now); // If it's emptry, don't do anything. if (pattern.length() == 0) { unlockInputs(); return error(); } // Tokenize the range so we can handle multiple blocks. pattern.tokenize(tokens, " "); // Try to find the 'id' point attribute on the 1st input geometry. id_gah = gdp->findPointAttribute(GA_SCOPE_PUBLIC, "id"); // If it doesn't exist, display a node error message and exit. if (id_gah.isInvalid()) { addError(SOP_MESSAGE, "Input geometry has no 'id' attribute."); unlockInputs(); return error(); } // Bind the page handles to the attributes. id_ph.bind(id_gah.getAttribute()); // Iterate over all the points we selected. for (GA_Iterator it(gdp->getPointRange()); it.blockAdvance(start, end); ) { // Set the page handle to the start of this block. id_ph.setPage(start); // Iterate over all the points in the block. for (GA_Offset pt = start; pt < end; ++pt) { // Get the 'id' value for the point. id = id_ph.get(pt); id_map[id] = pt; } } // Create the group. group = createAdhocPointGroup(*gdp); // Add the group and the id map to the pair. pair.first = group; pair.second = &id_map; // Iterate over each block in the tokens and add any ids to the group. for (int i=0; i < tokens.getArgc(); ++i) { UT_String id_range(tokens[i]); id_range.traversePattern(-1, &pair, addOffsetToGroup); } // Destroy the points. gdp->destroyPointOffsets(GA_Range(*group)); unlockInputs(); return error(); }
void HoudiniScene::readTags( NameList &tags, bool includeChildren ) const { tags.clear(); const OP_Node *node = retrieveNode(); if ( !node ) { return; } // add user supplied tags if we're not inside a SOP if ( !m_contentIndex && node->hasParm( pTags.getToken() ) ) { UT_String parmTagStr; node->evalString( parmTagStr, pTags.getToken(), 0, 0 ); if ( !parmTagStr.equal( UT_String::getEmptyString() ) ) { UT_WorkArgs tokens; parmTagStr.tokenize( tokens, " " ); for ( int i = 0; i < tokens.getArgc(); ++i ) { tags.push_back( tokens[i] ); } } } // add tags from the registered tag readers std::vector<CustomTagReader> &tagReaders = customTagReaders(); for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it ) { NameList values; it->m_read( node, values, includeChildren ); tags.insert( tags.end(), values.begin(), values.end() ); } // add tags based on primitive groups OBJ_Node *contentNode = retrieveNode( true )->castToOBJNode(); if ( contentNode && contentNode->getObjectType() == OBJ_GEOMETRY && m_splitter ) { GU_DetailHandle newHandle = m_splitter->split( contentPathValue() ); if ( !newHandle.isNull() ) { GU_DetailHandleAutoReadLock readHandle( newHandle ); if ( const GU_Detail *geo = readHandle.getGdp() ) { GA_Range prims = geo->getPrimitiveRange(); for ( GA_GroupTable::iterator<GA_ElementGroup> it=geo->primitiveGroups().beginTraverse(); !it.atEnd(); ++it ) { GA_PrimitiveGroup *group = static_cast<GA_PrimitiveGroup*>( it.group() ); if ( group->getInternal() || group->isEmpty() ) { continue; } const UT_String &groupName = group->getName(); if ( groupName.startsWith( tagGroupPrefix ) && group->containsAny( prims ) ) { UT_String tag; groupName.substr( tag, tagGroupPrefix.length() ); tag.substitute( "_", ":" ); tags.push_back( tag.buffer() ); } } } } } }
bool HoudiniScene::hasTag( const Name &name, bool includeChildren ) const { const OP_Node *node = retrieveNode(); if ( !node ) { return false; } // check for user supplied tags if we're not inside a SOP if ( !m_contentIndex && node->hasParm( pTags.getToken() ) ) { UT_String parmTags; node->evalString( parmTags, pTags.getToken(), 0, 0 ); if ( UT_String( name.c_str() ).multiMatch( parmTags ) ) { return true; } } // check with the registered tag readers std::vector<CustomTagReader> &tagReaders = customTagReaders(); for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it ) { if ( it->m_has( node, name ) ) { return true; } } // check tags based on primitive groups OBJ_Node *contentNode = retrieveNode( true )->castToOBJNode(); if ( contentNode && contentNode->getObjectType() == OBJ_GEOMETRY && m_splitter ) { GU_DetailHandle newHandle = m_splitter->split( contentPathValue() ); if ( !newHandle.isNull() ) { GU_DetailHandleAutoReadLock readHandle( newHandle ); if ( const GU_Detail *geo = readHandle.getGdp() ) { GA_Range prims = geo->getPrimitiveRange(); for ( GA_GroupTable::iterator<GA_ElementGroup> it=geo->primitiveGroups().beginTraverse(); !it.atEnd(); ++it ) { GA_PrimitiveGroup *group = static_cast<GA_PrimitiveGroup*>( it.group() ); if ( group->getInternal() || group->isEmpty() ) { continue; } const UT_String &groupName = group->getName(); if ( groupName.startsWith( tagGroupPrefix ) && group->containsAny( prims ) ) { UT_String tag; groupName.substr( tag, tagGroupPrefix.length() ); tag.substitute( "_", ":" ); if ( tag.equal( name.c_str() ) ) { return true; } } } } } } return false; }
/*! * Fill the GUI tree with the styles as defined in the XP tree. */ void AP_Win32Dialog_Stylist::_fillTree(void) { Stylist_tree * pStyleTree = getStyleTree(); if(pStyleTree == NULL) { updateDialog(); pStyleTree = getStyleTree(); } if(pStyleTree->getNumRows() == 0) { updateDialog(); pStyleTree = getStyleTree(); } UT_DEBUGMSG(("Number of rows of styles in document %d \n",pStyleTree->getNumRows())); HWND hTree = GetDlgItem(m_hWnd, AP_RID_DIALOG_STYLIST_TREE_STYLIST); // Purge any existing TreeView items TreeView_DeleteAllItems(hTree); TV_ITEM tvi; TV_INSERTSTRUCT tvins; HTREEITEM hParentItem; // Parent handle to link Styles to their Heading tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_CHILDREN; tvi.stateMask =0; UT_sint32 row, col; UT_UTF8String sTmp(""), str_loc; UT_String str; //int iter = 0; // Unique key for each item in the treeview for(row= 0; row < pStyleTree->getNumRows(); row++) { if(!pStyleTree->getNameOfRow(sTmp,row)) { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); break; } pt_PieceTable::s_getLocalisedStyleName (sTmp.utf8_str(), str_loc); str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); xxx_UT_DEBUGMSG(("Adding Heading %s at row %d \n",sTmp.utf8_str(),row)); // Insert the item into the treeview tvi.pszText = (LPTSTR)str.c_str(); tvi.cchTextMax = str.length() + 1; tvi.lParam = row; if (pStyleTree->getNumCols(row) > 0) tvi.cChildren = 1; else tvi.cChildren = 0; tvins.item = tvi; tvins.hParent = TVI_ROOT; tvins.hInsertAfter = TVI_LAST; hParentItem = TreeView_InsertItem(hTree, &tvins); // Add any children (columns) this row contains to be added if (pStyleTree->getNumCols(row) > 0) { for(col = 0; col < pStyleTree->getNumCols(row); col++) { if(!pStyleTree->getStyleAtRowCol(sTmp,row,col)) { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); break; } xxx_UT_DEBUGMSG(("Adding style %s at row %d col %d \n",sTmp.utf8_str(),row,col+1)); pt_PieceTable::s_getLocalisedStyleName (sTmp.utf8_str(), str_loc); str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); // Insert the item into the treeview tvi.pszText = (LPTSTR)str.c_str(); tvi.cchTextMax = str.length() + 1; tvi.cChildren = 0; tvi.lParam = col; tvins.item = tvi; tvins.hParent = hParentItem; tvins.hInsertAfter = TVI_LAST; TreeView_InsertItem(hTree, &tvins); } } } setStyleTreeChanged(false); }
void AP_Dialog_Options::_storeWindowData(void) { XAP_Prefs *pPrefs = m_pApp->getPrefs(); UT_return_if_fail (pPrefs); AP_FrameData *pFrameData = NULL; if(m_pFrame) { pFrameData = (AP_FrameData *)m_pFrame->getFrameData(); UT_return_if_fail (pFrameData); } XAP_PrefsScheme *pPrefsScheme = pPrefs->getCurrentScheme(); UT_return_if_fail (pPrefsScheme); // turn off all notification to PrefListeners via XAP_Prefs pPrefs->startBlockChange(); // before we continue to remember all the changed values, check to see if // we have turned OFF PrefsAutoSave. If so, toggle that value, then force // a prefs save, then update everything else // [email protected] if ( pPrefs->getAutoSavePrefs() == true && _gatherPrefsAutoSave() == false ) { pPrefs->setAutoSavePrefs( false ); pPrefs->savePrefsFile(); // TODO: check the results } else { // otherwise, just set the value pPrefs->setAutoSavePrefs( _gatherPrefsAutoSave() ); } // try again to make sure we've got an updatable scheme pPrefsScheme = pPrefs->getCurrentScheme(true); UT_return_if_fail (pPrefsScheme); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // save the values to the Prefs classes Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_AutoSpellCheck, _gatherSpellCheckAsType() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_AutoGrammarCheck, _gatherGrammarCheck() ); Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_SmartQuotesEnable, _gatherSmartQuotes() ); Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_CustomSmartQuotes, _gatherCustomSmartQuotes() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_SpellCheckCaps, _gatherSpellUppercase() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_SpellCheckNumbers, _gatherSpellNumbers() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_CursorBlink, _gatherViewCursorBlink() ); // Not implemented for UNIX or Win32. No need for it. #if !defined(TOOLKIT_GTK) && !defined(TOOLKIT_COCOA) && !defined (TOOLKIT_WIN) Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_RulerVisible, _gatherViewShowRuler() ); UT_uint32 i; for (i = 0; i < m_pApp->getToolbarFactory()->countToolbars(); i++) { Save_Pref_Bool( pPrefsScheme, m_pApp->getToolbarFactory()->prefKeyForToolbar(i), _gatherViewShowToolbar(i)); } Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_StatusBarVisible, _gatherViewShowStatusBar() ); #endif Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_ParaVisible, _gatherViewUnprintable() ); #if defined(TOOLKIT_GTK) Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_EnableSmoothScrolling, _gatherEnableSmoothScrolling() ); #endif Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_InsertModeToggle, _gatherEnableOverwrite() ); Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_AutoLoadPlugins, _gatherAutoLoadPlugins() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_DefaultDirectionRtl, _gatherOtherDirectionRtl() ); Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_ChangeLanguageWithKeyboard, _gatherLanguageWithKeyboard() ); Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_DirMarkerAfterClosingParenthesis, _gatherDirMarkerAfterClosingParenthesis()); // JOAQUIN - fix this: Dom UT_DEBUGMSG(("Saving Auto Save File [%i]\n", _gatherAutoSaveFile())); Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_AutoSaveFile, _gatherAutoSaveFile() ); UT_String stVal; _gatherAutoSaveFileExt(stVal); UT_DEBUGMSG(("Saving Auto Save File Ext [%s]\n", stVal.c_str())); pPrefsScheme->setValue(XAP_PREF_KEY_AutoSaveFileExt, stVal.c_str()); _gatherAutoSaveFilePeriod(stVal); UT_DEBUGMSG(("Saving Auto Save File with a period of [%s]\n", stVal.c_str())); pPrefsScheme->setValue(XAP_PREF_KEY_AutoSaveFilePeriod, stVal.c_str()); // Jordi: win32 specific for now _gatherUILanguage(stVal); if (stVal.length()) { UT_DEBUGMSG(("Setting default UI language to [%s]\n", stVal.c_str())); pPrefsScheme->setValue(AP_PREF_KEY_StringSet, stVal.c_str()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // If we changed whether the ruler is to be visible // or hidden, then update the current window: // (If we didn't change anything, leave it alone) #if !defined(TOOLKIT_GTK) && !defined(TOOLKIT_COCOA) && !defined (TOOLKIT_WIN) if (pFrameData && _gatherViewShowRuler() != pFrameData->m_bShowRuler ) { pFrameData->m_bShowRuler = _gatherViewShowRuler() ; if (!pFrameData->m_bIsFullScreen) { m_pFrame->toggleRuler(pFrameData->m_bShowRuler); } } // Same for status bar if (pFrameData && _gatherViewShowStatusBar() != pFrameData->m_bShowStatusBar) { pFrameData->m_bShowStatusBar = _gatherViewShowStatusBar(); if (!pFrameData->m_bIsFullScreen) { m_pFrame->toggleStatusBar(pFrameData->m_bShowStatusBar); } } if(pFrameData) { for (i = 0; i < m_pApp->getToolbarFactory()->countToolbars(); i++) { if (_gatherViewShowToolbar(i) != pFrameData->m_bShowBar[i]) { pFrameData->m_bShowBar[i] = _gatherViewShowToolbar(i); if (!pFrameData->m_bIsFullScreen) { m_pFrame->toggleBar(i, pFrameData->m_bShowBar[i]); } } } } #endif if (pFrameData && _gatherViewUnprintable() != pFrameData->m_bShowPara ) { pFrameData->m_bShowPara = _gatherViewUnprintable() ; AV_View * pAVView = m_pFrame->getCurrentView(); UT_return_if_fail (pAVView); FV_View * pView = static_cast<FV_View *> (pAVView); pView->setShowPara(pFrameData->m_bShowPara); } #if defined(TOOLKIT_GTK) if ( _gatherEnableSmoothScrolling() != XAP_App::getApp()->isSmoothScrollingEnabled() ) { XAP_App::getApp()->setEnableSmoothScrolling(_gatherEnableSmoothScrolling()); } #endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // save ruler units value pPrefsScheme->setValue((gchar*)AP_PREF_KEY_RulerUnits, (gchar*)UT_dimensionName( _gatherViewRulerUnits()) ); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // save screen color pPrefsScheme->setValue((gchar*)XAP_PREF_KEY_ColorForTransparent, _gatherColorForTransparent() ); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // allow XAP_Prefs to notify all the listeners of changes // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // TODO: change to snprintf gchar szBuffer[40]; sprintf( szBuffer, "%i", _gatherNotebookPageNum() ); pPrefsScheme->setValue((gchar*)AP_PREF_KEY_OptionsTabNumber, (gchar*)szBuffer ); // allow the prefListeners to receive their calls pPrefs->endBlockChange(); // if we hit the Save button, then force a save after the gather if ( m_answer == a_SAVE ) { pPrefs->savePrefsFile(); // TODO: check the results } }