void DDScreen::PrintText(int x, int y, const char* text)
{
    HFONT font = ::CreateFont
    (
        12,
        8,
        0,
        0,
        0,
        false,
        false,
        false,
        DEFAULT_CHARSET,
        OUT_DEFAULT_PRECIS,
        CLIP_DEFAULT_PRECIS,
        ANTIALIASED_QUALITY,
        FF_ROMAN,
        NULL
    );

    DDSurface *dest = GetDisplay().GetBackBuffer();
    
    TCHAR_string out = ToTCHAR(text);
    dest->DrawText(font, (TCHAR*)out.c_str(), x, y, 0L, 0xC0FF00);

    ::DeleteObject(font);
}
void
JXDisplayMenu::BuildMenu()
{
	RemoveAllItems();

	JXApplication* app = JXGetApplication();
	const JSize count = app->GetDisplayCount();
	for (JIndex i=1; i<=count; i++)
		{
		JXDisplay* display = app->GetDisplay(i);
		AppendItem(display->GetName(), kRadioType);
		}

	ShowSeparatorAfter(count);
	AppendItem(kNewDisplayStr);
	itsNewDisplayIndex = count+1;

	SetUpdateAction(kDisableNone);

	const JBoolean found =
		(JXGetApplication())->GetDisplayIndex(GetDisplay(), &itsDisplayIndex);
	assert( found );

	ListenTo(this);
	ListenTo( (JXGetApplication())->GetDisplayList() );
}
Exemple #3
0
static int
X11_ShowCursor(SDL_Cursor * cursor)
{
    Cursor x11_cursor = 0;

    if (cursor) {
        x11_cursor = (Cursor)cursor->driverdata;
    } else {
        x11_cursor = X11_CreateEmptyCursor();
    }

    /* FIXME: Is there a better way than this? */
    {
        SDL_VideoDevice *video = SDL_GetVideoDevice();
        Display *display = GetDisplay();
        SDL_Window *window;
        SDL_WindowData *data;

        for (window = video->windows; window; window = window->next) {
            data = (SDL_WindowData *)window->driverdata;
            if (x11_cursor != None) {
                XDefineCursor(display, data->xwindow, x11_cursor);
            } else {
                XUndefineCursor(display, data->xwindow);
            }
        }
        XFlush(display);
    }
    return 0;
}
Exemple #4
0
static Cursor
X11_CreateXCursorCursor(SDL_Surface * surface, int hot_x, int hot_y)
{
    Display *display = GetDisplay();
    Cursor cursor = None;
    XcursorImage *image;

    image = XcursorImageCreate(surface->w, surface->h);
    if (!image) {
        SDL_OutOfMemory();
        return None;
    }
    image->xhot = hot_x;
    image->yhot = hot_y;
    image->delay = 0;

    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
    SDL_assert(surface->pitch == surface->w * 4);
    SDL_memcpy(image->pixels, surface->pixels, surface->h * surface->pitch);

    cursor = XcursorImageLoadCursor(display, image);

    XcursorImageDestroy(image);

    return cursor;
}
void
SVNPropertiesList::CopySelectedItems
	(
	const JBoolean fullPath
	)
{
	JTableSelection& s = GetTableSelection();
	if (!s.HasSelection())
		{
		return;
		}

	JPtrArray<JString> list(JPtrArrayT::kDeleteAll);
	JTableSelectionIterator iter(&s);
	JPoint cell;
	while (iter.Next(&cell))
		{
		list.Append(*((GetStringList()).NthElement(cell.y)));
		}

	JXTextSelection* data = new JXTextSelection(GetDisplay(), list);
	assert( data != NULL );

	(GetSelectionManager())->SetData(kJXClipboardName, data);
}
void
ClipboardWidget::HandleEditMenu
	(
	const JIndex index
	)
{
	if (index == kCopyCmd)
		{
		// We instantiate a selection object that is appropriate for
		// our data. 
		JXTextSelection* data = new JXTextSelection(GetDisplay(), itsText);
		assert(data != NULL);

		// The selection data is then given to the selection manager.
		if (!(GetSelectionManager())->SetData(kJXClipboardName, data))
			{
			(JGetUserNotification())->ReportError("Unable to copy to the X Clipboard.");
			}
		}
	else if (index == kPasteCmd)
		{
		// Paste if the clipboard has the type we need.
		Paste();
		}
}
void
JXImageWidget::SetXPM
	(
	const JXPM&			data,
	const JColorIndex	origBackColor
	)
{
	const JColorIndex backColor =
		(origBackColor == kJXTransparentColor ?
		 GetColormap()->GetDefaultBackColor() : origBackColor);

	if (itsOwnsImageFlag)
		{
		jdelete itsImage;
		}

	itsImage = jnew JXImage(GetDisplay(), data);
	assert( itsImage != NULL );

	itsOwnsImageFlag = kJTrue;

	AdjustBounds();

	SetBackColor(backColor);
	Refresh();
}
void
JXImageButton::SetBitmap
	(
	const JConstBitmap&	bitmap,
	const JColorIndex	origForeColor,
	const JColorIndex	origBackColor
	)
{
	const JColorIndex foreColor =
		(origForeColor == kJXTransparentColor ?
		 (GetColormap())->GetBlackColor() : origForeColor);

	const JColorIndex backColor =
		(origBackColor == kJXTransparentColor ?
		 (GetColormap())->GetDefaultBackColor() : origBackColor);

	if (itsOwnsImageFlag)
		{
		delete itsImage;
		}

	itsImage = new JXImage(GetDisplay(), GetColormap(), bitmap, foreColor, backColor);
	assert( itsImage != NULL );

	itsOwnsImageFlag = kJTrue;

	SetBackColor(backColor);
	Refresh();
}
Exemple #9
0
static void
X11_DestroyEmptyCursor(void)
{
    if (x11_empty_cursor != None) {
        X11_XFreeCursor(GetDisplay(), x11_empty_cursor);
        x11_empty_cursor = None;
    }
}
JXTabGroup::JXTabGroup
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x,y, w,h),
	itsEdge(kTop),
	itsFontName(JGetDefaultFontName()),
	itsFontSize(kJDefaultFontSize),
	itsCanScrollUpFlag(kJFalse),
	itsCanScrollDownFlag(kJFalse),
	itsFirstDrawIndex(1),
	itsLastDrawIndex(1),
	itsContextMenu(NULL),
	itsPrevTabIndex(0),
	itsDragAction(kInvalidClick),
	itsScrollUpPushedFlag(kJFalse),
	itsScrollDownPushedFlag(kJFalse),
	itsMouseIndex(0),
	itsClosePushedFlag(kJFalse)
{
	itsTitles = new JPtrArray<JString>(JPtrArrayT::kDeleteAll);
	assert( itsTitles != NULL );

	itsTabInfoList = new JArray<TabInfo>;
	assert( itsTabInfoList != NULL );

	itsCloseImage = new JXImage(GetDisplay(), jx_tab_close);
	assert( itsCloseImage != NULL );

	itsClosePushedImage = new JXImage(GetDisplay(), jx_tab_close_pushed);
	assert( itsClosePushedImage != NULL );

	itsTabRects = new JArray<JRect>;
	assert( itsTabRects != NULL );

	itsCardFile = new JXCardFile(this, kHElastic, kVElastic, 0,0, 100,100);
	assert( itsCardFile != NULL );
	PlaceCardFile();
}
void WindowData::CloseDisplay()
{
    if (display)
    {
        XCloseDisplay(GetDisplay());
        display = 0;
    }
}
JXRowHeaderWidget::JXRowHeaderWidget
	(
	JXTable*			table,
	JXScrollbarSet*		scrollbarSet,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXEditTable(1,w, NULL, enclosure, hSizing,vSizing, x,y, w,h)
{
	assert( table != NULL && scrollbarSet != NULL );

	itsTable = table;
	itsTable->SetRowHeader(this);
	ListenTo(itsTable);

	itsVScrollbar = scrollbarSet->GetVScrollbar();
	ListenTo(itsVScrollbar);

	itsTitles = NULL;

	itsAllowRowResizingFlag = kJFalse;
	itsMinRowHeight         = 1;
	itsHMarginWidth         = 2*kCellFrameWidth;
	itsMaxBcastWidth        = 0;

	itsDragType = kInvalidDrag;

	itsDragLineCursor    = JXGetDragHorizLineCursor(GetDisplay());
	itsDragAllLineCursor = JXGetDragAllHorizLineCursor(GetDisplay());

	SetColBorderInfo(0, (GetColormap())->GetBlackColor());

	// override JXEditTable

	WantInput(kJFalse);
	SetBackColor((GetColormap())->GetDefaultBackColor());

	AppendCols(1, GetApertureWidth());
	AdjustToTable();
}
void
TestWidget::PrintSelectionText
	(
	const Atom selectionName,
	const Time time,
	const Atom type
	)
	const
{
	JXDisplay* display         = GetDisplay();
	JXSelectionManager* selMgr = GetSelectionManager();

	Atom returnType;
	unsigned char* data;
	JSize dataLength;
	JXSelectionManager::DeleteMethod delMethod;
	if (selMgr->GetData(selectionName, time, type,
						&returnType, &data, &dataLength, &delMethod))
		{
		if (returnType == XA_STRING ||
			returnType == selMgr->GetUtf8StringXAtom() ||
			returnType == selMgr->GetMimePlainTextXAtom())
			{
			std::cout << "Data is available as " << XGetAtomName(*display, type) << ":" << std::endl << std::endl;

			std::cout.write((char*) data, dataLength);
			std::cout << std::endl << std::endl;
			}
		else
			{
			std::cout << "Data has unrecognized return type:  ";
			std::cout << XGetAtomName(*(GetDisplay()), returnType) << std::endl;
			std::cout << "Trying to print it anyway:" << std::endl << std::endl;

			std::cout.write((char*) data, dataLength);
			std::cout << std::endl << std::endl;
			}

		selMgr->DeleteData(&data, delMethod);
		}
	else
		{
		std::cout << "Data could not be retrieved as " << XGetAtomName(*display, type) << "." << std::endl << std::endl;
		}
}
JXColHeaderWidget::JXColHeaderWidget
	(
	JXTable*			table,
	JXScrollbarSet*		scrollbarSet,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXEditTable(h,1, NULL, enclosure, hSizing,vSizing, x,y, w,h)
{
	assert( table != NULL && scrollbarSet != NULL );

	itsTable = table;
	itsTable->SetColHeader(this);
	ListenTo(itsTable);

	itsHScrollbar = scrollbarSet->GetHScrollbar();
	ListenTo(itsHScrollbar);

	itsTitles = NULL;

	itsAllowColResizingFlag = kJFalse;
	itsMinColWidth          = 1;

	itsDragType = kInvalidDrag;

	itsDragLineCursor    = JXGetDragVertLineCursor(GetDisplay());
	itsDragAllLineCursor = JXGetDragAllVertLineCursor(GetDisplay());

	SetDrawOrder(kDrawByRow);
	SetRowBorderInfo(0, (GetColormap())->GetBlackColor());

	// override JXEditTable

	WantInput(kJFalse);
	SetBackColor((GetColormap())->GetDefaultBackColor());

	AppendRows(1, GetApertureHeight());
	AdjustToTable();
}
Exemple #15
0
static int
X11_WarpMouseGlobal(int x, int y)
{
    Display *display = GetDisplay();

    X11_XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, x, y);
    X11_XSync(display, False);
    return 0;
}
void AnalogInputConfigSlipPoint::UpdateUpperStatusLine()
{
    Display* p_display = NULL;
    char display_number[10];

    int index = mpCurrentAnalogInputNumber->GetAsInt();

    sprintf(display_number, "4.4.1.%i", index);

    p_display = GetDisplay( DISPLAY_AI_CONFIG_ID );
    p_display->SetDisplayNumber( display_number );

    sprintf(display_number, "4.4.1.%i.1", index);

    p_display = GetDisplay( DISPLAY_AI_CONFIG_SELECT_MEAS_ID );
    p_display->SetDisplayNumber( display_number );

    DisplayController::GetInstance()->RequestTitleUpdate();
}
void
JXTextMenu::SetItemImage
	(
	const JIndex	index,
	const JXPM&		data
	)
{
	JXImage* image = GetDisplay()->GetImageCache()->GetImage(data);
	if (image->GetXColormap() == GetColormap())
		{
		SetItemImage(index, image, kJFalse);
		}
	else
		{
		JXImage* image = jnew JXImage(GetDisplay(), data);
		assert( image != NULL );
		SetItemImage(index, image, kJTrue);
		}
}
Exemple #18
0
static void
X11_FreeCursor(SDL_Cursor * cursor)
{
    Cursor x11_cursor = (Cursor)cursor->driverdata;

    if (x11_cursor != None) {
        X11_XFreeCursor(GetDisplay(), x11_cursor);
    }
    SDL_free(cursor);
}
JBoolean
TestWidget::WillAcceptDrop
(
    const JArray<Atom>&	typeList,
    Atom*				action,
    const Time			time,
    const JXWidget*		source
)
{
    JXDNDManager* dndMgr = GetDNDManager();

    if (typeList.GetFirstElement() == (GetSelectionManager())->GetURLXAtom())
    {
        cout << endl;
        cout << "Accepting the drop of type text/uri-list" << endl;
        cout << endl;

        *action = dndMgr->GetDNDActionPrivateXAtom();
        return kJTrue;
    }
    else if (*action == dndMgr->GetDNDActionCopyXAtom())
    {
        cout << endl;
        cout << "Accepting the drop" << endl;
        cout << endl;

        PrintSelectionText(dndMgr->GetDNDSelectionName(), time,
                           (GetSelectionManager())->GetMimePlainTextXAtom());
        return kJTrue;
    }
    else
    {
        JXDisplay* display = GetDisplay();

        cout << endl;
        cout << "Not accepting the drop because the action isn't copy" << endl;
        cout << "Action: " << XGetAtomName(*display, *action) << endl;
        cout << endl;
        cout << "Data types available from DND source:" << endl;
        cout << endl;

        const JSize typeCount = typeList.GetElementCount();
        for (JIndex i=1; i<=typeCount; i++)
        {
            const Atom type = typeList.GetElement(i);
            cout << XGetAtomName(*display, type) << endl;
        }
        cout << endl;

        PrintSelectionText(dndMgr->GetDNDSelectionName(), time,
                           (GetSelectionManager())->GetMimePlainTextXAtom());

        return kJFalse;
    }
}
CBSearchDocument::CBSearchDocument
	(
	const JBoolean		isReplace,
	const JBoolean		onlyListFiles,
	const JSize			fileCount,
	JProcess*			p,
	const int			fd,
	const JCharacter*	windowTitle
	)
	:
	CBExecOutputDocument(kCBSearchOutputFT, kCBSearchFilesHelpName, kJFalse, kJFalse),
	itsIsReplaceFlag(isReplace),
	itsOnlyListFilesFlag(onlyListFiles),
	itsReplaceTE(NULL)
{
	itsFoundFlag       = kJFalse;
	itsPrevQuoteOffset = 0;

	JXWidget::HSizingOption hSizing;
	JXWidget::VSizingOption vSizing;
	GetFileDisplayInfo(&hSizing, &vSizing);

	itsIndicator =
		jnew JXProgressIndicator(GetWindow(), hSizing, vSizing,
								 -1000, -1000, 500, kIndicatorHeight);
	assert( itsIndicator != NULL );
	itsIndicator->SetMaxValue(fileCount);

	JXMenuBar* menuBar = GetMenuBar();
	itsMatchMenu = InsertTextMenu(kMatchMenuTitleStr);
	itsMatchMenu->SetMenuItems(kMatchMenuStr, "CBSearchDocument");
	itsMatchMenu->SetUpdateAction(JXMenu::kDisableNone);
	itsMatchMenu->Deactivate();
	ListenTo(itsMatchMenu);

	// allow Meta-_ to parallel Shift key required for Meta-plus

	JXKeyModifiers modifiers(GetDisplay());
	modifiers.SetState(kJXMetaKeyIndex, kJTrue);
	GetWindow()->InstallMenuShortcut(itsMatchMenu, kPrevMatchCmd, '_', modifiers);

	GetWindow()->SetWMClass(CBGetWMClassInstance(), CBGetSearchOutputWindowClass());

	SetConnection(p, fd, ACE_INVALID_HANDLE,
				  windowTitle, JGetString("NoCloseWhileSearching::CBSearchDocument"),
				  "/", windowTitle, kJFalse);

	(CBGetDocumentManager())->SetActiveListDocument(this);

	if (itsIsReplaceFlag)
		{
		itsReplaceTE = jnew CBSearchTE;
		assert( itsReplaceTE != NULL );
		}
}
void
JXImageButton::SetImage
	(
	const JXPM&			xpm,
	const JColorIndex	backColor
	)
{
	JXImage* image = new JXImage(GetDisplay(), GetColormap(), xpm);
	assert( image != NULL );
	SetImage(image, kJTrue, backColor);
}
Exemple #22
0
void
JXImageMenu::SetItemImage
	(
	const JIndex	index,
	const JXPM&		data
	)
{
	JXImage* image = new JXImage(GetDisplay(), GetColormap(), data);
	assert( image != NULL );
	SetItemImage(index, image, kJTrue);
}
void
Test2DPlotDirector::BuildWindow()
{
// begin JXLayout

    JXWindow* window = new JXWindow(this, 600,400, "");
    assert( window != NULL );

    JXMenuBar* menuBar =
        new JXMenuBar(window,
                    JXWidget::kHElastic, JXWidget::kFixedTop, 0,0, 600,30);
    assert( menuBar != NULL );

    itsPlotWidget =
        new JX2DPlotWidget(menuBar, window,
                    JXWidget::kHElastic, JXWidget::kVElastic, 0,30, 600,370);
    assert( itsPlotWidget != NULL );

// end JXLayout

	window->SetMinSize(300, 200);

	itsPSPrinter = new JXPSPrinter(GetDisplay());
	assert( itsPSPrinter != NULL );
	itsPlotWidget->SetPSPrinter(itsPSPrinter);

	itsEPSPrinter = new JX2DPlotEPSPrinter(GetDisplay());
	assert( itsEPSPrinter != NULL );
	itsPlotWidget->SetEPSPrinter(itsEPSPrinter);

	ListenTo(itsPlotWidget);

	itsActionsMenu = menuBar->PrependTextMenu(kActionsMenuTitleStr);
	itsActionsMenu->SetMenuItems(kActionsMenuStr);
	itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsActionsMenu);

	// do this after everything is constructed so Receive() doesn't crash

	itsPlotWidget->SetTitle("New plot");
}
Exemple #24
0
DllExport s32 CALLBACK PADopen(void* pDisplay) // PAD OPEN
{
	DebugFunc();

	Input::Pause(false);

	GetDisplay(pDisplay);
	KeyboardOpen();
	KeepAwake(KEEPAWAKE_INIT);

	return emupro::pad::ERR_SUCCESS;
}
Exemple #25
0
void
VRManager::SubmitFrame(VRLayerParent* aLayer, layers::PTextureParent* aTexture,
                       const gfx::Rect& aLeftEyeRect,
                       const gfx::Rect& aRightEyeRect)
{
  TextureHost* th = TextureHost::AsTextureHost(aTexture);
  mLastFrame = th;
  RefPtr<VRDisplayHost> display = GetDisplay(aLayer->GetDisplayID());
  if (display) {
    display->SubmitFrame(aLayer, 0, aTexture, aLeftEyeRect, aRightEyeRect);
  }
}
void
JXExprWidget::JXExprEditorX()
{
	// required by JXGetCurrColormap
	assert( GetWindow()->GetColormap() == GetDisplay()->GetColormap() );

	// insure that we have a JFunction to display
	// (also calls EIPBoundsChanged and EIPAdjustNeedTab)

	ClearFunction();
	EIPDeactivate();
}
void GISModel::RemoveDisplay(int iNumber)
{
	LOG_LEVEL4("RemoveDisplay()");

	GDisplay* oDisplay = GetDisplay(iNumber);
	
	if(oDisplay != NULL) 
	{			
		m_oDisplays->remove(iNumber);
		delete oDisplay;
	}
}
Exemple #28
0
// display weather popups
// wParam = the contact to display popup
// lParam = whether the weather data is changed or not
int WeatherPopup(WPARAM hContact, LPARAM lParam) 
{
	// determine if the popup should display or not
	if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) &&
		!db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0))
	{
		WEATHERINFO winfo = LoadWeatherInfo(hContact);

		// setup the popup
		POPUPDATAT ppd = { 0 };
		ppd.lchContact = hContact;
		ppd.PluginData = ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, winfo.status);
		GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName);
		GetDisplay(&winfo, opt.pText, ppd.lptzText);
		ppd.PluginWindowProc = PopupDlgProc;
		ppd.colorBack = (opt.UseWinColors)?GetSysColor(COLOR_BTNFACE):opt.BGColour;
		ppd.colorText = (opt.UseWinColors)?GetSysColor(COLOR_WINDOWTEXT):opt.TextColour;
		ppd.iSeconds = opt.pDelay;
		PUAddPopupT( &ppd );
	}
	return 0;
}
Exemple #29
0
long XxColor::GetPixel (void)
{
    if (!AllocDone) {
        GetColor
        ( GetDisplay ()
        , DefaultColormap (GetDisplay (), GetScreen ())
        , Color
        );
/*
        Color.
cerr << "C" << endl;
        XAllocColor
        ( GetDisplay ()
        , DefaultColormap (GetDisplay (), GetScreen ())
        , &Color
        );
*/
        AllocDone   = 1;
    };

    return Color.pixel;
};
Exemple #30
0
XxWindow::XxWindow
    ( EzString Name
    , XxWindow *Parent
    , int XPos, int YPos, int Width, int Height
    , EzString Title
    )
    : XxDrawable (Name), Member (this), WindowsMember (this)
{
    Window               XxParentWindow;
    Atom                 atom;

    XxWindow::Parent   = Parent;

    Hints.x            = XPos;
    Hints.y            = YPos;
    Hints.width        = Width;
    Hints.height       = Height;

    XxAttrs.event_mask =   ExposureMask
                         | EnterWindowMask | LeaveWindowMask
                         | ButtonPressMask | ButtonReleaseMask;

    XxAttrMask         = CWEventMask;

    WindowsMember.Attach  (WindowsOwner);
    if (Parent != NULL) Member.Attach (Parent->Owner);

    XxParentWindow =
        (Parent == NULL ? GetRootWindow () : Parent->Xid);

    Xid = XCreateWindow
        ( GetDisplay (), XxParentWindow
        , Hints.x, Hints.y, Hints.width, Hints.height
        , 0, GetDepth ()
        , InputOutput, CopyFromParent
        , XxAttrMask, &XxAttrs);

    XxAttrMask = 0;

    Hints.max_width    = Width;
    Hints.max_height   = Height;
    Hints.min_width    = Width;
    Hints.min_height   = Height;
    Hints.flags        = PMinSize | PMaxSize | PPosition | PSize;

    XSetNormalHints (GetDisplay (), Xid, &Hints);
    // XStoreName      (GetDisplay (), Xid, "Test");

    XMapRaised      (GetDisplay (), Xid);
    XSelectInput    (GetDisplay (), Xid, XxAttrs.event_mask);

    if (Parent == NULL) {
        atom = GetWmDeleteWindow ();

        XStoreName      (GetDisplay (), Xid, Title);
        XSetWMProtocols (GetDisplay (), Xid, &atom, 1);
    };
};