Пример #1
0
/**
 * Constructor
 */ 
AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {

    // call this first
    initStrings();

    Gtk::Notebook *tabs=new Gtk::Notebook();

    tabs->set_scrollable();

    Gtk::Widget *splash=build_splash_widget();
    if (splash) {
        tabs->append_page(*manage(splash), _("_Splash"), true);
    }

    tabs->append_page(*manage(
        make_scrolled_text(authors_text)), _("_Authors"), true);
    tabs->append_page(*manage(
        make_scrolled_text(translators_text)), _("_Translators"), true);
    tabs->append_page(*manage(
        make_scrolled_text(license_text)), _("_License"), true);

#if WITH_GTKMM_3_0
    get_content_area()->pack_end(*manage(tabs), true, true);
#else
    get_vbox()->pack_end(*manage(tabs), true, true);
#endif

    tabs->show_all();

    add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
    set_default_response(Gtk::RESPONSE_CLOSE);

    Gtk::Label *label=new Gtk::Label();
    gchar *label_text = 
        g_strdup_printf("<small>Inkscape %s</small>",
              Inkscape::version_string);
    label->set_markup(label_text);
    label->set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER);
    label->set_padding(5,0);
    g_free(label_text);
    label->set_selectable(true);
    label->show();

#if WITH_GTKMM_3_0
    get_content_area()->pack_start(*manage(label), false, false);
#else
    get_vbox()->pack_start(*manage(label), false, false);
#endif

    Gtk::Requisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
    gtk_widget_get_preferred_size(reinterpret_cast<GtkWidget*>(gobj()), &requisition, NULL);
#else
    gtk_widget_size_request (reinterpret_cast<GtkWidget*>(gobj()), &requisition);
#endif
    // allow window to shrink
    set_size_request(0, 0);
    set_default_size(requisition.width, requisition.height);
}
Пример #2
0
bool HIDDeviceManager::Enumerate(HIDEnumerateVisitor* enumVisitor)
{
    HDEVINFO                 hdevInfoSet;
    SP_DEVICE_INTERFACE_DATA interfaceData;
    interfaceData.cbSize = sizeof(interfaceData);

    // Get handle to info data set describing all available HIDs.
    hdevInfoSet = SetupDiGetClassDevsA(&HidGuid, NULL, NULL, DIGCF_INTERFACEDEVICE | DIGCF_PRESENT);
    if (hdevInfoSet == INVALID_HANDLE_VALUE)
        return false;

    for(int deviceIndex = 0;
            SetupDiEnumDeviceInterfaces(hdevInfoSet, NULL, &HidGuid, deviceIndex, &interfaceData);
            deviceIndex++)
    {
        // For each device, we extract its file path and open it to get attributes,
        // such as vendor and product id. If anything goes wrong, we move onto next device.
        HIDDevicePathWrapper pathWrapper;
        if (!pathWrapper.InitPathFromInterfaceData(hdevInfoSet, &interfaceData))
            continue;

        // Look for the device to check if it is already opened.
        Ptr<DeviceCreateDesc> existingDevice = Manager->FindDevice(pathWrapper.GetPath());
        // if device exists and it is opened then most likely the CreateHIDFile
        // will fail; therefore, we just set Enumerated to 'true' and continue.
        if (existingDevice && existingDevice->pDevice)
        {
            existingDevice->Enumerated = true;
            continue;
        }

        // open device in non-exclusive mode for detection...
        HANDLE hidDev = CreateHIDFile(pathWrapper.GetPath(), false);
        if (hidDev == INVALID_HANDLE_VALUE)
            continue;

        HIDDeviceDesc devDesc;
        devDesc.Path = pathWrapper.GetPath();
        if (initVendorProductVersion(hidDev, &devDesc) &&
                enumVisitor->MatchVendorProduct(devDesc.VendorId, devDesc.ProductId) &&
                initUsage(hidDev, &devDesc))
        {
            initStrings(hidDev, &devDesc);

            // Construct minimal device that the visitor callback can get feature reports from.
            Win32::HIDDevice device(this, hidDev);
            enumVisitor->Visit(device, devDesc);
        }

        ::CloseHandle(hidDev);
    }

    SetupDiDestroyDeviceInfoList(hdevInfoSet);
    return true;
}
Пример #3
0
bool HIDDeviceManager::Enumerate(HIDEnumerateVisitor* enumVisitor)
{
    if (!initializeManager())
    {
        return false;
    }
    

	CFSetRef deviceSet = IOHIDManagerCopyDevices(HIDManager);
	CFIndex deviceCount = CFSetGetCount(deviceSet);
    
    // Allocate a block of memory and read the set into it.
    IOHIDDeviceRef* devices = (IOHIDDeviceRef*) OVR_ALLOC(sizeof(IOHIDDeviceRef) * deviceCount);
    CFSetGetValues(deviceSet, (const void **) devices);
    

    // Iterate over devices.
    for (CFIndex deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++)
    {
        IOHIDDeviceRef hidDev = devices[deviceIndex];
        
        if (!hidDev)
        {
            continue;
        }
        
        HIDDeviceDesc devDesc;
                
        if (getPath(hidDev, &(devDesc.Path)) &&
            initVendorProductVersion(hidDev, &devDesc) &&
            enumVisitor->MatchVendorProduct(devDesc.VendorId, devDesc.ProductId) &&
            initUsage(hidDev, &devDesc))
        {
            initStrings(hidDev, &devDesc);
            initSerialNumber(hidDev, &devDesc);

            // Construct minimal device that the visitor callback can get feature reports from.
            OSX::HIDDevice device(this, hidDev);
            
            enumVisitor->Visit(device, devDesc);
        }
    }
    
    OVR_FREE(devices);
    CFRelease(deviceSet);
    
    return true;
}
Пример #4
0
bool HIDDeviceManager::getFullDesc(HANDLE hidDev, HIDDeviceDesc* desc) const
{

    if (!initVendorProductVersion(hidDev, desc))
    {
        return false;
    }

    if (!initUsage(hidDev, desc))
    {
        return false;
    }

    initStrings(hidDev, desc);

    return true;
}
Пример #5
0
bool HIDDeviceManager::getFullDesc(IOHIDDeviceRef device, HIDDeviceDesc* desc)
{
        
    if (!initVendorProductVersion(device, desc))
    {
        return false;
    }
        
    if (!initUsage(device, desc))
    {
        return false;
    }
    
    if (!initSerialNumber(device, desc))
    {
        return false;
    }
    
    initStrings(device, desc);
        
    return true;
}
Пример #6
0
bool HIDDeviceManager::Enumerate(HIDEnumerateVisitor* enumVisitor)
{
    if (!initializeManager())
    {
        return false;
    }
    

	CFSetRef deviceSet = IOHIDManagerCopyDevices(HIDManager);
    if (!deviceSet)
        return false;
    
	CFIndex deviceCount = CFSetGetCount(deviceSet);
    
    // Allocate a block of memory and read the set into it.
    IOHIDDeviceRef* devices = (IOHIDDeviceRef*) OVR_ALLOC(sizeof(IOHIDDeviceRef) * deviceCount);
    CFSetGetValues(deviceSet, (const void **) devices);
    

    // Iterate over devices.
    for (CFIndex deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++)
    {
        IOHIDDeviceRef hidDev = devices[deviceIndex];
        
        if (!hidDev)
        {
            continue;
        }
        
        HIDDeviceDesc devDesc;
                
        if (getPath(hidDev, &(devDesc.Path)) &&
            initVendorProductVersion(hidDev, &devDesc) &&
            enumVisitor->MatchVendorProduct(devDesc.VendorId, devDesc.ProductId) &&
            initUsage(hidDev, &devDesc))
        {
            initStrings(hidDev, &devDesc);
            initSerialNumber(hidDev, &devDesc);

            // Look for the device to check if it is already opened.
            Ptr<DeviceCreateDesc> existingDevice = DevManager->FindHIDDevice(devDesc, true);
            // if device exists and it is opened then most likely the CreateHIDFile
            // will fail; therefore, we just set Enumerated to 'true' and continue.
            if (existingDevice && existingDevice->pDevice)
            {
                existingDevice->Enumerated = true;
                continue;
            }

            // open the device temporarily for startup communication
            if (IOHIDDeviceOpen(hidDev, kIOHIDOptionsTypeSeizeDevice) == kIOReturnSuccess)
            {
                // Construct minimal device that the visitor callback can get feature reports from.
                OSX::HIDDevice device(this, hidDev);

                enumVisitor->Visit(device, devDesc);

                IOHIDDeviceClose(hidDev, kIOHIDOptionsTypeSeizeDevice);
            }
        }
    }
    
    OVR_FREE(devices);
    CFRelease(deviceSet);
    
    return true;
}
Пример #7
0
int main()
{
    initStrings();

    localizeStrings(PageLabels);

    localizeNewMenu(menu);

    if(!(OpenURLBase = IExec->OpenLibrary(OPENURLNAME, OPENURLVER)))
         return -1;
    if(!(IOpenURL = (struct OpenURLIFace*)IExec->GetInterface(OpenURLBase, "main", 1L, NULL)))
        return -1;

    RA_SetUpHook(idcmphook, IDCMPFunc, NULL);

    if((AppPort = IExec->AllocSysObjectTags(ASOT_PORT, TAG_DONE)) != NULL)
    {
        IExec->NewList(&list_Brow);
        IExec->NewList(&list_Mail);
        IExec->NewList(&list_FTPs);

        win = make_window();
        edit_brow_win = make_edit_brow_win();
        edit_mail_win = make_edit_mail_win();
        edit_ftp_win = make_edit_ftp_win();

        loadPrefs(URL_GetPrefs_Mode_InUse);

        // Set up inter-group label alignment

        iset(OBJ(OBJ_FTP_ALIGN1), LAYOUT_AlignLabels, OBJ(OBJ_FTP_ALIGN2));
        iset(OBJ(OBJ_MAIL_ALIGN1), LAYOUT_AlignLabels, OBJ(OBJ_MAIL_ALIGN2));
        iset(OBJ(OBJ_LBROWSER_BROW), ICA_TARGET, OBJ(OBJ_EDIT_BROW),
                                     ICA_MAP,    lst2btn);

        if((window = RA_OpenWindow(win)) != NULL)
        {
            uint32 sigmask;
            BOOL done = FALSE;

            sigmask = iget(win, WINDOW_SigMask);
            while (!done)
            {
                uint32 siggot;

                siggot = IExec->Wait(sigmask);
                if (siggot & sigmask)
                {
                    done = HandleInput_Main_Win();
                    HandleInput_Edit_Brow_Win();
                    HandleInput_Edit_Mail_Win();
                    HandleInput_Edit_FTP_Win();
                }
            }
        }
        IIntuition->DisposeObject(edit_ftp_win);
        IIntuition->DisposeObject(edit_mail_win);
        IIntuition->DisposeObject(edit_brow_win);
        IIntuition->DisposeObject(win);

        //  The hidden chooser isn't attached to anything,
        //  so we must dispose of it ourselves...

        IIntuition->DisposeObject(OBJ(OBJ_HIDDEN_CHOOSER));

        IListBrowser->FreeListBrowserList(&list_FTPs);
        IListBrowser->FreeListBrowserList(&list_Mail);
        IListBrowser->FreeListBrowserList(&list_Brow);
        IExec->FreeSysObject(ASOT_PORT, AppPort);
    }

    IExec->DropInterface((struct Interface*)IOpenURL);
    IExec->CloseLibrary(OpenURLBase);

    uninitStrings();

    return 0;
}
Пример #8
0
ULONG query(void)
{
    LONG which = (LONG)REG_D0;
#else
ULONG SAVEDS ASM query(REG(d0,LONG which))
{
#endif
    switch (which)
    {
        case 0:  return (ULONG)lib_class;
        default: return 0;
    }
}

/****************************************************************************/

void
freeBase(void)
{
    if (MUIMasterBase)
    {
        freeAttach();
        freeMCC();

        CloseLibrary(MUIMasterBase);
        MUIMasterBase = NULL;
    }

    if (IFFParseBase)
    {
        CloseLibrary((struct Library *)IFFParseBase);
        IFFParseBase = NULL;
    }

    if (LocaleBase)
    {
        if (lib_cat) CloseCatalog(lib_cat);
        CloseLibrary((struct Library *)LocaleBase);
    }

    if (UtilityBase)
    {
        CloseLibrary(UtilityBase);
        UtilityBase = NULL;
    }

    if (IntuitionBase)
    {
        CloseLibrary((struct Library *)IntuitionBase);
        IntuitionBase = NULL;
    }

    if (DOSBase)
    {
        CloseLibrary((struct Library *)DOSBase);
        DOSBase = NULL;
    }

    if (lib_pool)
    {
        DeletePool(lib_pool);
        lib_pool = NULL;
    }

    lib_flags &= ~(BASEFLG_Init|BASEFLG_MUI20);
}

/***********************************************************************/

ULONG
initBase(void)
{
    if ((DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",37)) &&
        (IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",37)) &&
        (UtilityBase = OpenLibrary("utility.library",37)) &&
        (LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library",37)) &&
        (IFFParseBase = OpenLibrary("iffparse.library",37)) &&
        (MUIMasterBase = OpenLibrary("muimaster.library",19)) &&
        (lib_pool = CreatePool(MEMF_ANY|MEMF_CLEAR,512,256)))
    {
        if (MUIMasterBase->lib_Version>=MUIVER20) lib_flags |= BASEFLG_MUI20;
        initStrings();

        if (initAttach() && initMCC())
        {
            lib_flags |= BASEFLG_Init;

            return TRUE;
        }
    }

    freeBase();

    return FALSE;
}
Пример #9
0
void
init_image(ModeInfo * mi)
{
	Display *display = MI_DISPLAY(mi);
	Window window = MI_WINDOW(mi);
	imagestruct *ip;
	int i;

	if (ims == NULL) {
		if ((ims = (imagestruct *) calloc(MI_NUM_SCREENS(mi),
				sizeof (imagestruct))) == NULL)
			return;
	}
	ip = &ims[MI_SCREEN(mi)];
	if (message && *message) {
		XGCValues gcv;

#ifdef USE_MB
		mode_font = getFontSet(display);
		ip->text_descent = 0;
		ip->text_ascent = getFontHeight(mode_font);
#else
		mode_font = getFont(display);
		ip->text_descent = mode_font->descent;
		ip->text_ascent = mode_font->ascent;
#endif
		if (mode_font == None) {
			return;
		}
		initStrings(mi);
		ip->black = MI_BLACK_PIXEL(mi);

		free_image(display, ip);
		ip->pixh = (ip->lines + DELTA) * ip->text_height;
		if ((ip->pixmap = XCreatePixmap(display, window,
				ip->pixw, ip->pixh, 1)) == None) {
			free_image(display, ip);
			ip->pixw = 0;
			ip->pixh = 0;
			return;
		}
#ifndef USE_MB
		gcv.font = mode_font->fid;
#endif
		gcv.background = 0;
		gcv.foreground = 1;
		gcv.graphics_exposures = False;
		if ((ip->fgGC = XCreateGC(display, ip->pixmap,
				GCForeground | GCBackground | GCGraphicsExposures
#ifndef USE_MB
				| GCFont
#endif
				, &gcv)) == None) {
			free_image(display, ip);
			ip->pixw = 0;
			ip->pixh = 0;
			return;
		}
		gcv.foreground = 0;
		if ((ip->bgGC = XCreateGC(display, ip->pixmap,
				GCForeground | GCBackground | GCGraphicsExposures
#ifndef USE_MB
				| GCFont
#endif
				, &gcv)) == None) {
			free_image(display, ip);
			ip->pixw = 0;
			ip->pixh = 0;
			return;
		}
		XFillRectangle(display, ip->pixmap, ip->bgGC,
			0, 0, ip->pixw, ip->pixh);
		XSetForeground(display, MI_GC(mi), MI_WHITE_PIXEL(mi));
		for (i = 0; i < ip->lines; i++) {
			DrawString(display, ip->pixmap, ip->fgGC,
				ip->textStart[i],
				ip->text_ascent + i * ip->text_height,
				ip->strnew[i], strlen(ip->strnew[i]));
		}
		/* don't want any exposure events from XCopyPlane */
		XSetGraphicsExposures(display, MI_GC(mi), False);
	} else if (!initLogo(mi))
		return;

	ip->width = MI_WIDTH(mi);
	ip->height = MI_HEIGHT(mi);
	if (ip->width > ip->pixw)
		ip->ncols = ip->width / ip->pixw;
	else
		ip->ncols = 1;
	if (ip->height > ip->pixh)
		ip->nrows = ip->height / ip->pixh;
	else
		ip->nrows = 1;
	ip->border.x = ip->width - ip->ncols * ip->pixw;
	ip->border.y = ip->height - ip->nrows * ip->pixh;
	ip->iconcount = MI_COUNT(mi);
	if (ip->iconcount < -MINICONS)
		ip->iconcount = NRAND(-ip->iconcount - MINICONS + 1) + MINICONS;
	else if (ip->iconcount < MINICONS)
		ip->iconcount = MINICONS;
	if (ip->iconcount > ip->ncols * ip->nrows)
		ip->iconcount = ip->ncols * ip->nrows;
	if (ip->icons != NULL)
		free(ip->icons);
	if ((ip->icons = (imagetype *) malloc(ip->iconcount *
			sizeof (imagetype))) == NULL) {
		free_image(display, ip);
		return;
	}
	for (i = 0; i < ip->iconcount; i++)
		ip->icons[i].x = -1;
	if (!(message && *message)) {
		MI_CLEARWINDOWCOLORMAP(mi, ip->bgGC, ip->black);
	}
	draw_image(mi);
}