Esempio n. 1
0
BOOL COptionTreeItemFont::CreateFontItem(LOGFONT lfFont, COLORREF crFontColor, LOGFONT lfDefaultFont, COLORREF crDefaultFontColor, DWORD dwOptions)
{
	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Save options
	m_dwOptions = dwOptions;

	// Set font
	SetCurFont(lfFont);

	// Set default font
	SetDefaultFont(lfDefaultFont);

	// Set color
	SetTextColor(crFontColor);

	// Set default font color
	SetDefaultTextColor(crDefaultFontColor);

	// Get default height
	m_lDefaultHeight = GetHeight();

	return TRUE;
}
JXPathInput::JXPathInput
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXInputField(enclosure, hSizing, vSizing, x,y, w,h),
	itsCompleter(NULL),
	itsCompletionMenu(NULL)
{
	itsAllowInvalidPathFlag = kJFalse;
	itsRequireWriteFlag     = kJFalse;
	itsExpectURLDropFlag    = kJFalse;
	SetIsRequired();
	SetCharacterInWordFunction(IsCharacterInWord);
	SetDefaultFont(JGetMonospaceFontName(), kJDefaultMonoFontSize, JFontStyle());
	ShouldBroadcastCaretLocationChanged(kJTrue);
	SetHint(JGetString(kHintID));
	ListenTo(this);
}
Esempio n. 3
0
ControlPad::ControlPad()
{ 
	m_fAction = FALSE;
	m_ptCurrent.x = 0;
	m_ptCurrent.y = 0;
	m_nHeight = 200;
	m_nWidth = 200;


	SetDefaultFont();
} 
JBoolean
JXStringCompletionMenu::AddString
	(
	const JCharacter* str
	)
{
	const JIndex i = GetItemCount()+1;
	if (i <= kMaxItemCount)
		{
		if (IsEmpty())
			{
			JFontID id;
			JSize size;
			JFontStyle style;
			itsTE->GetDefaultFont(&id, &size, &style);
			SetDefaultFont(id, size, style, kJFalse);
			}

		JString shortcut;
		if (i <= 10)
			{
			shortcut = JString(i%10, JString::kBase10);
			}
		else if (i <= 36)
			{
			shortcut = " ";
			shortcut.SetCharacter(1, 'a' + i - 11);
			}

		JString s = kItemPrefixStr;
		s += str;
		if (!shortcut.IsEmpty())
			{
			s.SetCharacter(1, shortcut.GetFirstCharacter());
			s.SetCharacter(3, '-');
			}

		AppendItem(s, kPlainType, shortcut);
		return kJTrue;
		}
	else if (i == kMaxItemCount+1)
		{
		AppendItem(kTruncationStr);
		SetItemFont(i, JGetDefaultFontName(), kJDefaultFontSize,
					JFontStyle(kJFalse, kJTrue, 0, kJFalse));
		return kJFalse;
		}
	else
		{
		return kJFalse;
		}
}
void
JXInputField::SetFont
	(
	const JCharacter*	name,
	const JSize			size,
	const JFontStyle&	style
	)
{
	if (!IsEmpty())
		{
		JXTEBase::SetFont(1, GetTextLength(), name, size, style, kJTrue);
		}

	SetDefaultFont(name, size, style);
}
Esempio n. 6
0
int
main(int argc, char *argv[], char *envp[])
#endif
{
    int i;
    HWEventQueueType alwaysCheckForInput[2];

    display = "0";

    InitRegions();

    CheckUserParameters(argc, argv, envp);

    CheckUserAuthorization();

    InitConnectionLimits();

    ProcessCommandLine(argc, argv);

    alwaysCheckForInput[0] = 0;
    alwaysCheckForInput[1] = 1;
    while (1) {
        serverGeneration++;
        ScreenSaverTime = defaultScreenSaverTime;
        ScreenSaverInterval = defaultScreenSaverInterval;
        ScreenSaverBlanking = defaultScreenSaverBlanking;
        ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
#ifdef DPMSExtension
        DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
        DPMSEnabled = TRUE;
        DPMSPowerLevel = 0;
#endif
        InitBlockAndWakeupHandlers();
        /* Perform any operating system dependent initializations you'd like */
        OsInit();
        if (serverGeneration == 1) {
            CreateWellKnownSockets();
            for (i = 1; i < MAXCLIENTS; i++)
                clients[i] = NullClient;
            serverClient = calloc(sizeof(ClientRec), 1);
            if (!serverClient)
                FatalError("couldn't create server client");
            InitClient(serverClient, 0, (pointer) NULL);
        }
        else
            ResetWellKnownSockets();
        clients[0] = serverClient;
        currentMaxClients = 1;

        /* Initialize privates before first allocation */
        dixResetPrivates();

        /* Initialize server client devPrivates, to be reallocated as
         * more client privates are registered
         */
        if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
            FatalError("failed to create server client privates");

        if (!InitClientResources(serverClient)) /* for root resources */
            FatalError("couldn't init server resources");

        SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
        screenInfo.numScreens = 0;

        InitAtoms();
        InitEvents();
        InitSelections();
        InitGlyphCaching();
        dixResetRegistry();
        ResetFontPrivateIndex();
        InitCallbackManager();
        InitOutput(&screenInfo, argc, argv);

        if (screenInfo.numScreens < 1)
            FatalError("no screens found");
        InitExtensions(argc, argv);

        for (i = 0; i < screenInfo.numGPUScreens; i++) {
            ScreenPtr pScreen = screenInfo.gpuscreens[i];
            if (!CreateScratchPixmapsForScreen(pScreen))
                FatalError("failed to create scratch pixmaps");
        }

        for (i = 0; i < screenInfo.numScreens; i++) {
            ScreenPtr pScreen = screenInfo.screens[i];

            if (!CreateScratchPixmapsForScreen(pScreen))
                FatalError("failed to create scratch pixmaps");
            if (pScreen->CreateScreenResources &&
                !(*pScreen->CreateScreenResources) (pScreen))
                FatalError("failed to create screen resources");
            if (!CreateGCperDepth(i))
                FatalError("failed to create scratch GCs");
            if (!CreateDefaultStipple(i))
                FatalError("failed to create default stipple");
            if (!CreateRootWindow(pScreen))
                FatalError("failed to create root window");
        }

        InitFonts();
        if (SetDefaultFontPath(defaultFontPath) != Success) {
            ErrorF("[dix] failed to set default font path '%s'",
                   defaultFontPath);
        }
        if (!SetDefaultFont(defaultTextFont)) {
            FatalError("could not open default font '%s'", defaultTextFont);
        }

        if (!(rootCursor = CreateRootCursor(NULL, 0))) {
            FatalError("could not open default cursor font '%s'",
                       defaultCursorFont);
        }

#ifdef DPMSExtension
        /* check all screens, looking for DPMS Capabilities */
        DPMSCapableFlag = DPMSSupported();
        if (!DPMSCapableFlag)
            DPMSEnabled = FALSE;
#endif

#ifdef PANORAMIX
        /*
         * Consolidate window and colourmap information for each screen
         */
        if (!noPanoramiXExtension)
            PanoramiXConsolidate();
#endif

        for (i = 0; i < screenInfo.numScreens; i++)
            InitRootWindow(screenInfo.screens[i]->root);

        InitCoreDevices();
        InitInput(argc, argv);
        InitAndStartDevices();
        ReserveClientIds(serverClient);

        dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);

#ifdef PANORAMIX
        if (!noPanoramiXExtension) {
            if (!PanoramiXCreateConnectionBlock()) {
                FatalError("could not create connection block info");
            }
        }
        else
#endif
        {
            if (!CreateConnectionBlock()) {
                FatalError("could not create connection block info");
            }
        }

#ifdef XQUARTZ
        /* Let the other threads know the server is done with its init */
        pthread_mutex_lock(&serverRunningMutex);
        serverRunning = TRUE;
        pthread_cond_broadcast(&serverRunningCond);
        pthread_mutex_unlock(&serverRunningMutex);
#endif

        NotifyParentProcess();

        Dispatch();

#ifdef XQUARTZ
        /* Let the other threads know the server is no longer running */
        pthread_mutex_lock(&serverRunningMutex);
        serverRunning = FALSE;
        pthread_mutex_unlock(&serverRunningMutex);
#endif

        UndisplayDevices();
        DisableAllDevices();

        /* Now free up whatever must be freed */
        if (screenIsSaved == SCREEN_SAVER_ON)
            dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
        FreeScreenSaverTimer();
        CloseDownExtensions();

#ifdef PANORAMIX
        {
            Bool remember_it = noPanoramiXExtension;

            noPanoramiXExtension = TRUE;
            FreeAllResources();
            noPanoramiXExtension = remember_it;
        }
#else
        FreeAllResources();
#endif

        CloseInput();

        for (i = 0; i < screenInfo.numScreens; i++)
            screenInfo.screens[i]->root = NullWindow;

        CloseDownDevices();

        CloseDownEvents();

        for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
            ScreenPtr pScreen = screenInfo.gpuscreens[i];
            FreeScratchPixmapsForScreen(pScreen);
            (*pScreen->CloseScreen) (pScreen);
            dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
            free(pScreen);
            screenInfo.numGPUScreens = i;
        }

        for (i = screenInfo.numScreens - 1; i >= 0; i--) {
            FreeScratchPixmapsForScreen(screenInfo.screens[i]);
            FreeGCperDepth(i);
            FreeDefaultStipple(i);
            dixFreeScreenSpecificPrivates(screenInfo.screens[i]);
            (*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);
            dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
            free(screenInfo.screens[i]);
            screenInfo.numScreens = i;
        }

        ReleaseClientIds(serverClient);
        dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
        serverClient->devPrivates = NULL;

        FreeFonts();

        FreeAuditTimer();

        if (dispatchException & DE_TERMINATE) {
            CloseWellKnownConnections();
        }

        OsCleanup((dispatchException & DE_TERMINATE) != 0);

        if (dispatchException & DE_TERMINATE) {
            ddxGiveUp(EXIT_NO_ERROR);
            break;
        }

        free(ConnectionInfo);
        ConnectionInfo = NULL;
    }
    return 0;
}
/*
================
CSyntaxRichEditCtrl::HighlightSyntax

  Update the syntax highlighting for the given character range.
================
*/
void CSyntaxRichEditCtrl::HighlightSyntax(int startCharIndex, int endCharIndex)
{
	int c, t, line, charIndex, textLength, syntaxStart, keyWordLength, keyWordIndex;
	const char *keyWord;
	CHARRANGE visRange;
	CString text;

	// get text length
	GetTextRange(0, GetTextLength(), text);
	textLength = text.GetLength();

	// make sure the indexes are within bounds
	if (startCharIndex < 0) {
		startCharIndex = 0;
	}

	if (endCharIndex < 0) {
		endCharIndex = textLength - 1;
	} else if (endCharIndex >= textLength) {
		endCharIndex = textLength - 1;
	}

	// move the start index to the beginning of the line
	for (; startCharIndex > 0; startCharIndex--) {
		if (idStr::CharIsNewLine(text[startCharIndex-1])) {
			break;
		}
	}

	// move the end index to the end of the line
	for (; endCharIndex < textLength - 1; endCharIndex++) {
		if (idStr::CharIsNewLine(text[endCharIndex+1])) {
			break;
		}
	}

	// get the visible char range
	visRange = GetVisibleRange();

	// never update beyond the visible range
	if (startCharIndex < visRange.cpMin) {
		SetColor(startCharIndex, visRange.cpMin - 1, SRE_COLOR_BLACK, INVALID_BACK_COLOR, false);
		startCharIndex = visRange.cpMin;
	}

	if (visRange.cpMax < endCharIndex) {
		SetColor(visRange.cpMax, endCharIndex, SRE_COLOR_BLACK, INVALID_BACK_COLOR, false);
		endCharIndex = visRange.cpMax;

		if (endCharIndex >= textLength) {
			endCharIndex = textLength - 1;
		}
	}

	// test if the start index is inside a multi-line comment
	if (startCharIndex > 0) {
		// multi-line comments have a slightly different background color
		if (GetBackColor(startCharIndex-1) == MULTILINE_COMMENT_BACK_COLOR) {
			for (; startCharIndex > 0; startCharIndex--) {
				if (text[startCharIndex] == '/' && text[startCharIndex+1] == '*') {
					break;
				}
			}
		}
	}

	// test if the end index is inside a multi-line comment
	if (endCharIndex < textLength - 1) {
		// multi-line comments have a slightly different background color
		if (GetBackColor(endCharIndex+1) == MULTILINE_COMMENT_BACK_COLOR) {
			for (endCharIndex++; endCharIndex < textLength - 1; endCharIndex++) {
				if (text[endCharIndex-1] == '*' && text[endCharIndex] == '/') {
					break;
				}
			}
		}
	}

	line = 0;
	stringColorLine = -1;
	stringColorIndex = 0;

	// set the default color
	SetDefaultFont(startCharIndex, endCharIndex + 1);

	// syntax based colors
	for (charIndex = startCharIndex; charIndex <= endCharIndex; charIndex++) {

		t = charType[text[charIndex]];

		switch (t) {
			case CT_WHITESPACE: {
				if (idStr::CharIsNewLine(text[charIndex])) {
					line++;
				}

				break;
			}
			case CT_COMMENT: {
				c = text[charIndex+1];

				if (c == '/') {
					// single line comment
					syntaxStart = charIndex;

					for (charIndex += 2; charIndex < textLength; charIndex++) {
						if (idStr::CharIsNewLine(text[charIndex])) {
							break;
						}
					}

					SetColor(syntaxStart, charIndex + 1, singleLineCommentColor, DEFAULT_BACK_COLOR, false);
				} else if (c == '*') {
					// multi-line comment
					syntaxStart = charIndex;

					for (charIndex += 2; charIndex < textLength; charIndex++) {
						if (text[charIndex] == '*' && text[charIndex+1] == '/') {
							break;
						}
					}

					charIndex++;
					SetColor(syntaxStart, charIndex + 1, multiLineCommentColor, MULTILINE_COMMENT_BACK_COLOR, false);
				}

				break;
			}
			case CT_STRING: {
				if (line != stringColorLine) {
					stringColorLine = line;
					stringColorIndex = 0;
				}

				syntaxStart = charIndex;

				for (charIndex++; charIndex < textLength; charIndex++) {
					c = text[charIndex];

					if (charType[c] == CT_STRING && text[charIndex-1] != '\\') {
						break;
					}

					if (idStr::CharIsNewLine(c)) {
						line++;
						break;
					}
				}

				SetColor(syntaxStart, charIndex + 1, stringColor[stringColorIndex], DEFAULT_BACK_COLOR, false);
				stringColorIndex ^= 1;
				break;
			}
			case CT_LITERAL: {
				syntaxStart = charIndex;

				for (charIndex++; charIndex < textLength; charIndex++) {
					c = text[charIndex];

					if (charType[c] == CT_LITERAL && text[charIndex-1] != '\\') {
						break;
					}

					if (idStr::CharIsNewLine(c)) {
						line++;
						break;
					}
				}

				SetColor(syntaxStart, charIndex + 1, literalColor, DEFAULT_BACK_COLOR, false);
				break;
			}
			case CT_NUMBER: {
				break;
			}
			case CT_NAME: {
				syntaxStart = charIndex;
				keyWord = ((const char *)text) + charIndex;

				for (charIndex++; charIndex < textLength; charIndex++) {
					c = text[charIndex];
					t = charType[c];

					if (t != CT_NAME && t != CT_NUMBER) {
						// allow path names
						if (!allowPathNames || (c != '/' && c != '\\' && c != '.')) {
							break;
						}
					}
				}

				keyWordLength = charIndex - syntaxStart;
				keyWordIndex = FindKeyWord(keyWord, keyWordLength);

				if (keyWordIndex != -1) {
					SetColor(syntaxStart, syntaxStart + keyWordLength, keyWordColors[keyWordIndex], DEFAULT_BACK_COLOR, false);
				}

				break;
			}
			case CT_PUNCTUATION: {
				break;
			}
		}
	}

	// show braced section
	BracedSectionShow();
}
Esempio n. 8
0
File: main.c Progetto: theqvd/vcxsrv
int
dix_main(int argc, char *argv[], char *envp[])
{
    int i;
    HWEventQueueType alwaysCheckForInput[2];
    #ifdef _DEBUG
    //int TmpFlag=_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG);
    
    //TmpFlag|=_CRTDBG_ALLOC_MEM_DF;
    //TmpFlag|=_CRTDBG_DELAY_FREE_MEM_DF;
    //TmpFlag|=_CRTDBG_CHECK_ALWAYS_DF;
    //TmpFlag|=_CRTDBG_CHECK_CRT_DF;
    //TmpFlag|=_CRTDBG_LEAK_CHECK_DF;
    
    //_CrtSetDbgFlag(TmpFlag);
    #endif

    ptw32_processInitialize();
    display = "0";

    #ifdef WIN32

    if (InitWSA()<0)
    {
      printf("Error initialising WSA\n");
      return -1;
    }
    /* In Win32 we have different threads call Xlib functions (depending
       on the commandline options given).
       XInitThreads has to be called before
       any xlib function is called (aoccording to the man page) */
    XInitThreads();
    /* change the current directory to the directory where the vcxsrv.exe executable is installed.
       This is needed because the font directories are relative to the current directory.
     */
     {
       char ModuleFilename[MAX_PATH];
       char *pSlash;
       GetModuleFileName(NULL,ModuleFilename,sizeof(ModuleFilename));
       pSlash=strrchr(ModuleFilename,'\\');
       if (pSlash)
       {
         *pSlash='\0';
         chdir(ModuleFilename);
       }
     }
    OsVendorPreInit(argc, argv);
    #endif

    InitRegions();

    CheckUserParameters(argc, argv, envp);

    CheckUserAuthorization();

    InitConnectionLimits();

    ProcessCommandLine(argc, argv);

    alwaysCheckForInput[0] = 0;
    alwaysCheckForInput[1] = 1;
    while (1) {
        serverGeneration++;
        ScreenSaverTime = defaultScreenSaverTime;
        ScreenSaverInterval = defaultScreenSaverInterval;
        ScreenSaverBlanking = defaultScreenSaverBlanking;
        ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
#ifdef DPMSExtension
        DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
        DPMSEnabled = TRUE;
        DPMSPowerLevel = 0;
#endif
        InitBlockAndWakeupHandlers();
        /* Perform any operating system dependent initializations you'd like */
        if (serverGeneration == 1) {
            CreateWellKnownSockets();
            for (i = 1; i < MAXCLIENTS; i++)
                clients[i] = NullClient;
            serverClient = calloc(sizeof(ClientRec), 1);
            if (!serverClient)
                FatalError("couldn't create server client");
            InitClient(serverClient, 0, (void *) NULL);
        }
        else
            ResetWellKnownSockets();
        clients[0] = serverClient;
        currentMaxClients = 1;
        OsInit();

        /* clear any existing selections */
        InitSelections();

        /* Initialize privates before first allocation */
        dixResetPrivates();

        /* Initialize server client devPrivates, to be reallocated as
         * more client privates are registered
         */
        if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
            FatalError("failed to create server client privates");

        if (!InitClientResources(serverClient)) /* for root resources */
            FatalError("couldn't init server resources");

        SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
        screenInfo.numScreens = 0;

        InitAtoms();
        InitEvents();
        InitGlyphCaching();
        dixResetRegistry();
        ResetFontPrivateIndex();
        InitCallbackManager();
        InitOutput(&screenInfo, argc, argv);

        if (screenInfo.numScreens < 1)
            FatalError("no screens found");
        InitExtensions(argc, argv);

        for (i = 0; i < screenInfo.numGPUScreens; i++) {
            ScreenPtr pScreen = screenInfo.gpuscreens[i];
            if (!CreateScratchPixmapsForScreen(pScreen))
                FatalError("failed to create scratch pixmaps");
            if (pScreen->CreateScreenResources &&
                !(*pScreen->CreateScreenResources) (pScreen))
                FatalError("failed to create screen resources");
        }

        for (i = 0; i < screenInfo.numScreens; i++) {
            ScreenPtr pScreen = screenInfo.screens[i];

            if (!CreateScratchPixmapsForScreen(pScreen))
                FatalError("failed to create scratch pixmaps");
            if (pScreen->CreateScreenResources &&
                !(*pScreen->CreateScreenResources) (pScreen))
                FatalError("failed to create screen resources");
            if (!CreateGCperDepth(i))
                FatalError("failed to create scratch GCs");
            if (!CreateDefaultStipple(i))
                FatalError("failed to create default stipple");
            if (!CreateRootWindow(pScreen))
                FatalError("failed to create root window");
        }

        InitFonts();
        if (SetDefaultFontPath(defaultFontPath) != Success) {
            ErrorF("[dix] failed to set default font path '%s'",
                   defaultFontPath);
        }
        if (!SetDefaultFont(defaultTextFont)) {
            FatalError("could not open default font '%s'", defaultTextFont);
        }

        if (!(rootCursor = CreateRootCursor(NULL, 0))) {
            FatalError("could not open default cursor font '%s'",
                       defaultCursorFont);
        }

#ifdef DPMSExtension
        /* check all screens, looking for DPMS Capabilities */
        DPMSCapableFlag = DPMSSupported();
        if (!DPMSCapableFlag)
            DPMSEnabled = FALSE;
#endif

#ifdef PANORAMIX
        /*
         * Consolidate window and colourmap information for each screen
         */
        if (!noPanoramiXExtension)
            PanoramiXConsolidate();
#endif

        for (i = 0; i < screenInfo.numScreens; i++)
            InitRootWindow(screenInfo.screens[i]->root);

        InitCoreDevices();
        InitInput(argc, argv);
        InitAndStartDevices();
        ReserveClientIds(serverClient);

        dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);

        dixCloseRegistry();

#ifdef PANORAMIX
        if (!noPanoramiXExtension) {
            if (!PanoramiXCreateConnectionBlock()) {
                FatalError("could not create connection block info");
            }
        }
        else
#endif
        {
            if (!CreateConnectionBlock()) {
                FatalError("could not create connection block info");
            }
        }

#ifdef XQUARTZ
        /* Let the other threads know the server is done with its init */
        pthread_mutex_lock(&serverRunningMutex);
        serverRunning = TRUE;
        pthread_cond_broadcast(&serverRunningCond);
        pthread_mutex_unlock(&serverRunningMutex);
#endif

        NotifyParentProcess();

        #ifdef _MSC_VER
        // initialise here because doing it in InitInput failes because keyboard device is not started yet then
        winInitializeModeKeyStates ();
        #endif

        Dispatch();

#ifdef XQUARTZ
        /* Let the other threads know the server is no longer running */
        pthread_mutex_lock(&serverRunningMutex);
        serverRunning = FALSE;
        pthread_mutex_unlock(&serverRunningMutex);
#endif

        UndisplayDevices();
        DisableAllDevices();

        /* Now free up whatever must be freed */
        if (screenIsSaved == SCREEN_SAVER_ON)
            dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
        FreeScreenSaverTimer();
        CloseDownExtensions();

#ifdef PANORAMIX
        {
            Bool remember_it = noPanoramiXExtension;

            noPanoramiXExtension = TRUE;
            FreeAllResources();
            noPanoramiXExtension = remember_it;
        }
#else
        FreeAllResources();
#endif

        CloseInput();

        for (i = 0; i < screenInfo.numScreens; i++)
            screenInfo.screens[i]->root = NullWindow;

        CloseDownDevices();

        CloseDownEvents();

        for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
            ScreenPtr pScreen = screenInfo.gpuscreens[i];
            FreeScratchPixmapsForScreen(pScreen);
            (*pScreen->CloseScreen) (pScreen);
            dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
            free(pScreen);
            screenInfo.numGPUScreens = i;
        }

        for (i = screenInfo.numScreens - 1; i >= 0; i--) {
            FreeScratchPixmapsForScreen(screenInfo.screens[i]);
            FreeGCperDepth(i);
            FreeDefaultStipple(i);
            dixFreeScreenSpecificPrivates(screenInfo.screens[i]);
            (*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);
            dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
            free(screenInfo.screens[i]);
            screenInfo.numScreens = i;
        }

        ReleaseClientIds(serverClient);
        dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
        serverClient->devPrivates = NULL;

	dixFreeRegistry();

        FreeFonts();

        FreeAllAtoms();

        FreeAuditTimer();

        DeleteCallbackManager();

        if (dispatchException & DE_TERMINATE) {
            CloseWellKnownConnections();
        }

        OsCleanup((dispatchException & DE_TERMINATE) != 0);

        if (dispatchException & DE_TERMINATE) {
            ddxGiveUp(EXIT_NO_ERROR);
            break;
        }

        free(ConnectionInfo);
        ConnectionInfo = NULL;
    }
    return 0;
}
Esempio n. 9
0
/*---------------------------------------------------------------------------*/
void wxSQLEditor::InitStyle()
{
   SetDefaultFont(wxGetApp().GetStyleFontName(), wxGetApp().GetStyleFontSize());
   SetEdgeMode(wxGetApp().GetEdgeLineVisible() ? wxSTC_EDGE_LINE : wxSTC_EDGE_NONE);

   SetDefaultStyle(wxGetApp().GetStyleFontBold(STYLE_DEFAULT),
                   wxGetApp().GetStyleFontItalic(STYLE_DEFAULT),
                   wxGetApp().GetStyleFontUnderline(STYLE_DEFAULT),
                   wxGetApp().GetStyleCase(STYLE_DEFAULT),
                   wxGetApp().GetStyleColourFore(STYLE_DEFAULT),
                   wxGetApp().GetStyleColourBack(STYLE_DEFAULT));

   SetCommentStyle(wxGetApp().GetStyleFontBold(STYLE_COMMENT),
                   wxGetApp().GetStyleFontItalic(STYLE_COMMENT),
                   wxGetApp().GetStyleFontUnderline(STYLE_COMMENT),
                   wxGetApp().GetStyleCase(STYLE_COMMENT),
                   wxGetApp().GetStyleColourFore(STYLE_COMMENT),
                   wxGetApp().GetStyleColourBack(STYLE_COMMENT));

   SetCommentLineStyle(wxGetApp().GetStyleFontBold(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleFontItalic(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleFontUnderline(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleCase(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleColourFore(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleColourBack(STYLE_COMMENTLINE));

   SetNumberStyle(wxGetApp().GetStyleFontBold(STYLE_NUMBER),
                  wxGetApp().GetStyleFontItalic(STYLE_NUMBER),
                  wxGetApp().GetStyleFontUnderline(STYLE_NUMBER),
                  wxGetApp().GetStyleCase(STYLE_NUMBER),
                  wxGetApp().GetStyleColourFore(STYLE_NUMBER),
                  wxGetApp().GetStyleColourBack(STYLE_NUMBER));

   SetKeyWordStyle(1, wxGetApp().GetStyleFontBold(STYLE_WORD1),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD1),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD1),
                   wxGetApp().GetStyleCase(STYLE_WORD1),
                   wxGetApp().GetStyleColourFore(STYLE_WORD1),
                   wxGetApp().GetStyleColourBack(STYLE_WORD1));

   SetStringStyle(wxGetApp().GetStyleFontBold(STYLE_STRING),
                  wxGetApp().GetStyleFontItalic(STYLE_STRING),
                  wxGetApp().GetStyleFontUnderline(STYLE_STRING),
                  wxGetApp().GetStyleCase(STYLE_STRING),
                  wxGetApp().GetStyleColourFore(STYLE_STRING),
                  wxGetApp().GetStyleColourBack(STYLE_STRING));

   SetCharacterStyle(wxGetApp().GetStyleFontBold(STYLE_CHARACTER),
                     wxGetApp().GetStyleFontItalic(STYLE_CHARACTER),
                     wxGetApp().GetStyleFontUnderline(STYLE_CHARACTER),
                     wxGetApp().GetStyleCase(STYLE_CHARACTER),
                     wxGetApp().GetStyleColourFore(STYLE_CHARACTER),
                     wxGetApp().GetStyleColourBack(STYLE_CHARACTER));

   SetOperatorStyle(wxGetApp().GetStyleFontBold(STYLE_OPERATOR),
                    wxGetApp().GetStyleFontItalic(STYLE_OPERATOR),
                    wxGetApp().GetStyleFontUnderline(STYLE_OPERATOR),
                    wxGetApp().GetStyleCase(STYLE_OPERATOR),
                    wxGetApp().GetStyleColourFore(STYLE_OPERATOR),
                    wxGetApp().GetStyleColourBack(STYLE_OPERATOR));

   SetIdentifierStyle(wxGetApp().GetStyleFontBold(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleFontItalic(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleFontUnderline(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleCase(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleColourFore(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleColourBack(STYLE_IDENTIFIER));

   SetKeyWordStyle(2, wxGetApp().GetStyleFontBold(STYLE_WORD2),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD2),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD2),
                   wxGetApp().GetStyleCase(STYLE_WORD2),
                   wxGetApp().GetStyleColourFore(STYLE_WORD2),
                   wxGetApp().GetStyleColourBack(STYLE_WORD2));

   SetKeyWordStyle(3, wxGetApp().GetStyleFontBold(STYLE_WORD3),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD3),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD3),
                   wxGetApp().GetStyleCase(STYLE_WORD3),
                   wxGetApp().GetStyleColourFore(STYLE_WORD3),
                   wxGetApp().GetStyleColourBack(STYLE_WORD3));

   SetKeyWordStyle(4, wxGetApp().GetStyleFontBold(STYLE_WORD4),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD4),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD4),
                   wxGetApp().GetStyleCase(STYLE_WORD4),
                   wxGetApp().GetStyleColourFore(STYLE_WORD4),
                   wxGetApp().GetStyleColourBack(STYLE_WORD4));


   SetTabWidth(wxGetApp().GetStyleTabWidth());
   SetUseTabs(wxGetApp().GetStyleUseTab());
   SetTabIndents(wxGetApp().GetStyleTabIndent());
   SetBackSpaceUnIndents(wxGetApp().GetStyleBackspaceUnindent());
   SetIndent(wxGetApp().GetStyleIndentWidth());

   SetLineNumberMarginStyle(wxGetApp().GetStyleShowLineNumber(),
                            wxGetApp().GetForeLineNumber(),
                            wxGetApp().GetBackLineNumber());
}