Ejemplo n.º 1
0
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)
{
	popup = false;
	Ctrl *q = owner ? owner->GetTopCtrl() : GetActiveCtrl();
	PopUpHWND(q ? q->GetHWND() : NULL, savebits, activate, dropshadow, topmost);
	if(top) top->owner = owner;
}
Ejemplo n.º 2
0
bool  Ctrl::HasFocusDeep() const
{
	GuiLock __;
	if(HasFocus() || HasChildDeep(FocusCtrl())) return true;
	Ctrl *a = GetActiveCtrl();
	if(!a || !a->IsPopUp()) return false;
	a = a->GetOwnerCtrl();
	return a && HasChildDeep(a);
}
Ejemplo n.º 3
0
static void k2400_UpdateReadings (int panel, void *dev)
{
    gpibioPtr my_dev = dev;
    k2400Ptr smu = my_dev->device;
	acqchanPtr acqchan = smu->source->acqchan;
    short statusbyte;
    char rsp[256];
    int control, dim, bg, mode, m;

	if (smu->operate) {
        if (utilG.acq.status == ACQ_BUSY)
			Delay(.05);
		if (!util_TakingData() || !(smu->source->acqchan->acquire || smu->measure->acquire)) {
            gpibio_GetStatusByte (dev, &statusbyte);
            if (statusbyte & K2400_SRE_READINGDONE) 
			{
				//k2400_In (dev, rsp);
                //Scan (rsp, "%s>%f,%f", &smu->source->acqchan->reading,
                //      &smu->measure->reading); 
            }
            //if (statusbyte & K2400_SRE_READYFORTRIGGER) 
				//k2400_Out (dev, "H0X", .02);
        }
		
		time(&present);
		if(difftime(present, past) >= delay)
		{
			k2400_GetReadings(acqchan);
			time(&past);
		}
        //if (expG.acqstatus != utilG.acq.status) 
		{
            m = GetPanelMenuBar (panel);
            dim = (util_TakingData() && smu->source->inlist &&
                   (utilG.exp == EXP_SOURCE));

            if (dim) { mode = VAL_INDICATOR; bg = VAL_PANEL_GRAY;}
                else { mode = VAL_HOT; bg = VAL_WHITE;}

            SetCtrlAttribute (panel, K2400_SOURCE, ATTR_CTRL_MODE, mode);
            SetCtrlAttribute (panel, K2400_SOURCE, ATTR_TEXT_BGCOLOR, bg);

            SetInputMode (panel, K2400_OPERATE, !dim);
            SetInputMode (panel, K2400_SELECT, !dim);
            SetInputMode (panel, K2400_SENSE, !dim);
            SetMenuBarAttribute (m, K2400MENUS_FILE_LOAD, ATTR_DIMMED, dim);
        }

        k2400_CheckforProblems (my_dev);
         SetCtrlVal (panel, K2400_OVERLIMIT, smu->overLimit);

        control = GetActiveCtrl (panel);
        if (util_TakingData() || (control != K2400_SOURCE))
            SetCtrlVal (panel, K2400_SOURCE, smu->source->acqchan->reading);
        SetCtrlVal (panel, K2400_MEASURE, smu->measure->reading);
    }
}
Ejemplo n.º 4
0
Archivo: K213.c Proyecto: gaorlov/DAAS
static void k213_UpdateReadings (int panel, void *dev)
{
    gpibioPtr my_dev = dev;
    k213Ptr quadsrc = my_dev->device;
    unsigned short statusbyte;
    char rsp[256];
    int control, dim, bg, mode, m, active_panel, port;

    for (port = 0; port < 4; port++) {
        if (!util_TakingData() || !quadsrc->port[port].src->acqchan->acquire)
            k213_GetPortLevel (port+1, dev);
    }

    if (expG.acqstatus != utilG.acq.status) {
        m = GetPanelMenuBar (panel);
        for (port = 0; port < 4; port++) {
            dim = (util_TakingData() && quadsrc->port[port].src->inlist &&
               (utilG.exp == EXP_SOURCE));

            if (dim) { mode = VAL_INDICATOR; bg = VAL_PANEL_GRAY;}
                else { mode = VAL_HOT; bg = VAL_WHITE;}

            SetCtrlAttribute (quadsrc->port[port].panel, K213PORT_DISPLAY, ATTR_CTRL_MODE, mode);
            SetCtrlAttribute (quadsrc->port[port].panel, K213PORT_DISPLAY, ATTR_TEXT_BGCOLOR, bg);

            SetInputMode (quadsrc->port[port].panel, K213PORT_AUTORANGE, !dim);
            SetInputMode (quadsrc->port[port].panel, K213PORT_RANGE, !dim);
        }
        SetMenuBarAttribute (m, K213MENUS_FILE_LOAD, ATTR_DIMMED, dim);
    }

    k213_CheckforProblems (my_dev);

    active_panel = GetActivePanel();
    control = GetActiveCtrl (active_panel);

    for (port = 0; port < 4; port++) {
        if (util_TakingData() || (control != K213PORT_DISPLAY))
            SetCtrlVal (quadsrc->port[port].panel, K213PORT_DISPLAY, quadsrc->port[port].src->acqchan->reading);
    }
}
Ejemplo n.º 5
0
void MenuBar::PostDeactivate()
{
	LLOG("PostDeactivate");
	MenuBar *q = GetLastSubmenu();
	MenuBar *u = q;
	while(q && q->IsPopUp()) {
		if(q->IsOpen() && q->HasFocusDeep())
			return;
		q = q->parentmenu;
	}
	if(u->IsPopUp()) {
		while(u->parentmenu && u->parentmenu->IsPopUp())
			u = u->parentmenu;
		Ctrl *w = GetActiveCtrl();
		while(w) {
			if(w == u) return;
			w = w->GetOwner();
		}
	}
	CloseMenu();
}
Ejemplo n.º 6
0
void  Ctrl::SetMouseCursor(const Image& image)
{
	LLOG("SetMouseCursor");
	GuiLock __;
	int64 id = image.GetSerialId();
	Ctrl *topctrl = NULL;
	Top *top = NULL;
	if(mouseCtrl)
		topctrl = mouseCtrl->GetTopCtrl();
	else
		topctrl = GetActiveCtrl();
	if(topctrl)
		top = topctrl->top;
	if(top && id != top->cursor_id) {
		top->cursor_id = id;
		int64 aux = image.GetAuxData();
		GdkCursor *c = NULL;
		if(aux)
			c = gdk_cursor_new((GdkCursorType)(aux - 1));
		else
		if(IsNull(image))
			c = gdk_cursor_new(GDK_BLANK_CURSOR);
		else {
			Point p = image.GetHotSpot();
			ImageGdk m;
			m.Set(image);
			GdkPixbuf *pb = m;
			if(pb)
				c = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pb, p.x, p.y);
		}
		if(c && topctrl->IsOpen()) {
			gdk_window_set_cursor(topctrl->gdk(), c);
			gdk_cursor_unref(c);
			gdk_flush(); // Make it visible immediately
		}
	}
}
Ejemplo n.º 7
0
void TopWindow::Open()
{
    Open(GetActiveCtrl());
}
Ejemplo n.º 8
0
bool Ctrl::DispatchKey(dword keycode, int count)
{
	GuiLock __;
	if(GUI_AltAccessKeys()) {
		bool alt = GetAlt();
		Ctrl *c = GetActiveCtrl();
		if(c)
			c->RefreshAccessKeysDo(alt);
	}
//	RLOGBLOCK("Ctrl::DispatchKey");
//	RLOG("DispatchKey: focusCtrl = " << FormatIntHex((int)~focusCtrl) << ", wnd = " << FormatIntHex((int)~focusCtrlWnd) << ")");
	LLOG("DispatchKey " << keycode << " (0x" << Sprintf("%08x", keycode)
		<< ", " << GetKeyDesc(keycode) << "), count:" << count
		<< " focusCtrl:" << UPP::Name(focusCtrl) << " focusCtrlWnd:" << UPP::Name(focusCtrlWnd));
	if((keycode & K_KEYUP) && ignorekeyup)
	{
		ignorekeyup = false;
		return true;
	}
	for(int i = 0; i < keyhook().GetCount(); i++)
		if((*keyhook()[i])(focusCtrl, keycode, count))
			return true;
	dword k = keycode;
	word l = LOWORD(keycode);
	if(!(k & K_DELTA) && l >= 32 && l != 127 && GetDefaultCharset() != CHARSET_UNICODE)
		k = MAKELONG((word)FromUnicode(l, CHARSET_DEFAULT), HIWORD(keycode));
	if(!focusCtrl)
		return false;
	Ptr<Ctrl> p = focusCtrl;
	if(Ini::user_log) {
		String kl;
		dword k = keycode;
		const char *l = "";
		if(k < 65536) {
			kl << "CHAR \'" << ToUtf8((wchar)keycode) << "\' (" << keycode << ')';
			l = "  ";
		}
		else {
			kl << "KEY";
			if(k & K_KEYUP) {
				kl << "UP";
				k &= ~K_KEYUP;
				l = "  ";
			}
			kl << " " << GetKeyDesc(k);
		}
		USRLOG(l << kl);
	}
	for(;;) {
		LLOG("Trying to DispatchKey: p = " << Desc(p));
		if(p->IsEnabled() && p->Key(p->unicode ? keycode : k, count))
		{
			LLOG("Ctrl::DispatchKey(" << FormatIntHex(keycode) << ", " << GetKeyDesc(keycode)
				<< "): eaten in " << Desc(p));
			if(Ini::user_log)
				USRLOG("  -> " << Desc(p));
			eventCtrl = focusCtrl;
			return true;
		}
		s_hotkey = true;
		if(!p->GetParent()) {
			if(p->HotKey(keycode)) {
				eventCtrl = focusCtrl;
				return true;
			}
			return false;
		}
		p = p->GetParent();
	}

	USRLOG("  key was ignored");

	return false;
}
Ejemplo n.º 9
0
Ctrl *Ctrl::GetActiveWindow()
{
	GuiLock __;
	Ctrl *q = GetActiveCtrl();
	return q ? q->GetTopWindow() : NULL;
}