void SandboxPlugin::ShapeScalePanelWidget::OnInit(  )
{
	m_Processor->GetParametersHolder()->AddObserver(
		this, &ShapeScalePanelWidget::UpdateWidget);

	UpdateWidget();
}
void Core::Widgets::WorkingAreaManagerWidget::OnRename( wxCommandEvent &event )
{
	if ( !GetActiveWorkingArea() )
	{
		return;
	}

	std::string name = AskName( GetActiveWorkingArea()->GetName().c_str() );
	if ( name.empty() )
	{
		return;
	}

	BaseWorkingAreaStorage::Pointer workingAreaStorage;
	workingAreaStorage = Core::Runtime::Kernel::GetGraphicalInterface()->GetWorkingAreaStorage( );
	workingAreaStorage->Delete( dynamic_cast<BaseWindow*> ( GetActiveWorkingArea() ) );

	GetActiveWorkingArea()->SetName( name );

	workingAreaStorage->Save( dynamic_cast<BaseWindow*> ( GetActiveWorkingArea() ) );

	UpdateWidget();

	GetPluginTab()->GetWindowsMapHolder()->NotifyObservers();
}
Exemplo n.º 3
0
void UpdateData(const int id, const char *value)
{
	char *text;

	text = cngplpSetData(g_cngplp_data, id, (char*)value);
	UpdateWidget(id, text);
}
Exemplo n.º 4
0
void UpdateDataCheck(const int id, const int active)
{
	char *text;
	char *str;

	str = (active != 0) ? "true" : "false";
	text = cngplpSetData(g_cngplp_data, id, str);
	UpdateWidget(id, text);
}
Exemplo n.º 5
0
void UpdateDataInt(const int id, const int value)
{
	char *text;
	char str[NUMDATA];
	memset(str, 0, NUMDATA - 1);
	snprintf(str, NUMDATA - 1, "%d", value);
	text = cngplpSetData(g_cngplp_data, id, str);
	UpdateWidget(id, text);
}
Exemplo n.º 6
0
void tGauge::SetOverlay( bool enabled )
{
    m_IsOverlay = enabled;

    if( m_IsOverlay && !m_Registered )
    {
        QString name = objectName() + m_Indicators.at(0).dataId.ToVariant().toStringList().join( QString("") );
        tOverlayManagerQueue::Instance()->RegisterOverlayWidget( this, tOverlayManagerQueue::OMPDigData, name );
        Connect( this, SIGNAL( UpdateWidgetFromResize() ), this, SLOT( UpdateWidget() ), Qt::QueuedConnection );
        m_Registered = true;
    }
    else if( !m_IsOverlay && m_Registered )
    {
        tOverlayManagerQueue::Instance()->UnRegisterOverlayWidget( this );
        disconnect( this, SIGNAL( UpdateWidgetFromResize() ), this, SLOT( UpdateWidget() ) );
        m_Registered = false;
    }
}
Exemplo n.º 7
0
void tGauge::InvalidateBackground()
{
    if( m_BackIsCached )
    {
        m_BackIsCached = false;
        update();
        UpdateWidget();
    }
}
Exemplo n.º 8
0
	bool UIManager::Update ( unsigned int timestep, Input::Mouse* pMouse )
	///////////////////////////////////////////////////////////////////////////
	{
		// Send the update to the widgets
		WidgetList* pList = _pCurrentScreen->GetWidgetList ( );
		UpdateWidget ( pList, timestep, pMouse );

		HostIntegration::Renderer->Update ( _pCurrentScreen, pMouse );

		return true;
	}
bool SandboxPlugin::ShapeScalePanelWidget::Enable( bool enable /*= true */ )
{
	bool bReturn = SandboxPluginShapeScalePanelWidgetUI::Enable( enable );

	// If this panel widget is selected -> Update the widget
	if ( enable )
	{
		UpdateWidget();
	}

	return bReturn;
}
Exemplo n.º 10
0
void HideDialog(const char *dlg_name, const gboolean flag)
{
	GtkWidget *widget;
	GtkWidget *top;
	char *text;
	SpecialInfo* special = NULL;

	if(g_config_file_data != NULL){
		special = g_config_file_data->special_list;
	}
	while(special != NULL){
		if(0 == strcasecmp(special->name, dlg_name)){
			break;
		}
		special = special->next;
	}
	widget = glade_xml_get_widget(g_cngplp_xml, dlg_name);
	if(NULL == widget){
		return;
	}
	InitUpdateOption(g_cngplp_data);
	if(FALSE == flag){
		special->print = 0;
		RestoreTopWidgetData(dlg_name);
	}else{
		if(special->print == 1){
			if(0 == strcasecmp(dlg_name, "IdPassWdDlg")){
				const char *ps = NULL;
				const char *usr = NULL;

				ps = GetTextEntry("PassWd_entry");
				usr = GetTextEntry("ID_entry");
				if((0 == (strlen(ps))) || (0 == (strlen(usr)))){
					return;
				}
			}
			if(0 == strcasecmp(dlg_name, "JobAccountDlg")){
				const char *jobusr = NULL;
				jobusr = GetTextEntry("JobAccountID_entry");
				if(0 == strlen(jobusr)){
					return;
				}
			}
		}
	}
	FreeTopWidgetSaveData(dlg_name);
	text = ExitUpdateOption(g_cngplp_data);
	UpdateWidget(ID_CNSKIPBLANK, text);

	top = gtk_widget_get_toplevel(widget);
	gtk_widget_hide(top);
	gtk_main_quit();
}
Exemplo n.º 11
0
	void UIManager::UpdateWidget ( WidgetList* pWidgetList, int timestep, Input::Mouse* pMouse  )
	///////////////////////////////////////////////////////////////////////////
	{
		for ( WidgetList::iterator i = pWidgetList->begin(); i != pWidgetList->end(); i++ )
		{
			(*i)->Update ( timestep );

			WidgetChildren::iterator j;
			WidgetChildren *pWidgetChildren = (*i)->GetWidgetChildren();
			for ( j = pWidgetChildren->begin(); j != pWidgetChildren->end(); j++ )
				UpdateWidget ( &(*j).children, timestep, pMouse );
		}
	}
Exemplo n.º 12
0
extern	void
UpdateWindow(char *windowName)
{
	WindowData	*wdata;
	WidgetData	*data;

	wdata = GetWindowData(windowName);
	g_return_if_fail(wdata != NULL);
	while(
		(data = (WidgetData *)DeQueueNoWait(wdata->UpdateWidgetQueue)) != NULL
	) {
		UpdateWidget(data);
	}
}
Exemplo n.º 13
0
void tGauge::InvalidateForeground()
{
    if( m_ForeIsCached )
    {
        m_ForeIsCached = false;
        QRect r( CalculateRegionToUpdate() );

#if defined SHOW_UPDATE_REGIONS && defined Q_OS_WIN
        m_AreaToUpdate = r;
        update();
#else
        update( r );
        UpdateWidget();
#endif
    }
}
Exemplo n.º 14
0
void UpdateDataCombo(const int id, const char *combo_entry_name)
{
	char *text;
	char *str;
	char *tmp;
	GtkWidget *entry = NULL;
	entry = glade_xml_get_widget(g_cngplp_xml, combo_entry_name);
	if(entry != NULL){
		tmp =(gchar*)gtk_entry_get_text(GTK_ENTRY(entry));
		str = TextToName(id, tmp);
		if(str == NULL){
			str = tmp;
		}
		text = cngplpSetData(g_cngplp_data, id, str);
		UpdateWidget(id, text);
	}
}
/**
 * replace connected field
 */
void MutexKnobData::SetMutexKnobDataConnected(int index, int connected)
{
    QMutexLocker locker(&mutex);

    if( KnobData[index].index == -1) return;

    KnobData[index].edata.connected = connected;

#ifdef epics4
    connectInfoShort *tmp = (connectInfoShort *) KnobData[index].edata.info;
    if (tmp != (connectInfoShort *) 0) tmp->connected = connected;
#endif

    if(!connected) {
        UpdateWidget(index, (QWidget*)KnobData[index].dispW, (char*) " ", (char*) " ",  (char*) " ", KnobData[index]);
    }

}
Exemplo n.º 16
0
void GPhotoCCD::UpdateExtendedOptions (bool force)
{
	map<string, cam_opt *>::iterator it;
    if(! expTID)
    {
		for ( it = CamOptions.begin() ; it != CamOptions.end(); it++ )
		{
			cam_opt *opt = (*it).second;
            if(force || gphoto_widget_changed(opt->widget))
            {
				gphoto_read_widget(opt->widget);
				UpdateWidget(opt);
			}
		}
	}

    optTID = IEAddTimer (1000, GPhotoCCD::UpdateExtendedOptions, this);
}
Exemplo n.º 17
0
MyWidget::MyWidget (QWidget * parent):QWidget (parent)
{

    Print_Version_Information();

    //
    //Print_Information_Processor ();
    bool cpuNehalem, cpuSandybridge, cpuIvybridge, cpuHaswell;
    Print_Information_Processor (&cpuNehalem, &cpuSandybridge, &cpuIvybridge, &cpuHaswell);

    Test_Or_Make_MSR_DEVICE_FILES ();

    Construct_Socket_Information_in_GUI(&numCPUs);

    char processor_str[100];
//    printf("MyWidget: Num Processors %d\n",numCPUs);
    int  i;

    for (i = 0; i < (int)numCPUs; i++)
    {
        C0_l[i] = new QProgressBar;
        C0_l[i]->setMaximum (99);
        C0_l[i]->setMinimum (0);
        C1_l[i] = new QProgressBar;
        C1_l[i]->setMaximum (99);
        C1_l[i]->setMinimum (0);
        C3_l[i] = new QProgressBar;
        C3_l[i]->setMaximum (99);
        C3_l[i]->setMinimum (0);
        C6_l[i] = new QProgressBar;
        C6_l[i]->setMaximum (99);
        C6_l[i]->setMinimum (0);
        Freq_[i] = new QLabel (tr (""));
    }

    QGridLayout * layout1 = new QGridLayout;

    curr_numCPUs = numCPUs;
    for (i = 0; i < (int)numCPUs; i++)
    {
        layout1->addWidget (C0_l[i], i + 1, 1);
        layout1->addWidget (C1_l[i], i + 1, 2);
        layout1->addWidget (C3_l[i], i + 1, 3);
        layout1->addWidget (C6_l[i], i + 1, 4);
    }

    C0 = new QLabel (tr ("C0"));
    C0->setAlignment (Qt::AlignCenter);
    C1 = new QLabel (tr ("C1"));
    C1->setAlignment (Qt::AlignCenter);
    C3 = new QLabel (tr ("C3"));
    C3->setAlignment (Qt::AlignCenter);
    C6 = new QLabel (tr ("C6"));
    C6->setAlignment (Qt::AlignCenter);

    snprintf(processor_str, 100, "Core-1 [id:%d,socket:%d]",core_list[0],socket_list[0]);
    ProcNames[0] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-2 [id:%d,socket:%d]",core_list[1],socket_list[1]);
    ProcNames[1] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-3 [id:%d,socket:%d]",core_list[2],socket_list[2]);
    ProcNames[2] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-4 [id:%d,socket:%d]",core_list[3],socket_list[3]);
    ProcNames[3] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-5 [id:%d,socket:%d]",core_list[4],socket_list[4]);
    ProcNames[4] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-6 [id:%d,socket:%d]",core_list[5],socket_list[5]);
    ProcNames[5] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-7 [id:%d,socket:%d]",core_list[6],socket_list[6]);
    ProcNames[6] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-8 [id:%d,socket:%d]",core_list[7],socket_list[7]);
    ProcNames[7] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-9 [id:%d,socket:%d]",core_list[8],socket_list[8]);
    ProcNames[8] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-10 [id:%d,socket:%d]",core_list[9],socket_list[9]);
    ProcNames[9] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-11 [id:%d,socket:%d]",core_list[10],socket_list[10]);
    ProcNames[10] = new QLabel (tr (processor_str));

    snprintf(processor_str, 100, "Core-12 [id:%d,socket:%d]",core_list[11],socket_list[11]);
    ProcNames[11] = new QLabel (tr (processor_str));

    StatusMessage0 = new QLabel (tr ("Wait"));
    Curr_Freq0 = new QLabel (tr ("Wait"));

    if ( (socket_0.num_physical_cores > 0) && (socket_1.num_physical_cores > 0)) {
        StatusMessage1 = new QLabel (tr ("Wait"));
        Curr_Freq1 = new QLabel (tr ("Wait"));
    }

    for (i = 0; i < (int)numCPUs; i++) {
        layout1->addWidget (ProcNames[i], i + 1, 0);
    }

    layout1->addWidget (C0, 0, 1);
    layout1->addWidget (C1, 0, 2);
    layout1->addWidget (C3, 0, 3);
    layout1->addWidget (C6, 0, 4);

    for (i = 0; i < (int)numCPUs; i++)
        layout1->addWidget (Freq_[i], i + 1, 5);

    layout1->addWidget (StatusMessage0, numCPUs + 1, 4);
    layout1->addWidget (Curr_Freq0, numCPUs + 1, 5);
    if ( (socket_0.num_physical_cores > 0) && (socket_1.num_physical_cores > 0)) {
        layout1->addWidget (StatusMessage1, numCPUs + 2, 4);
        layout1->addWidget (Curr_Freq1, numCPUs + 2, 5);
    }
    QTimer *timer = new QTimer (this);
    connect (timer, SIGNAL (timeout ()), this, SLOT (UpdateWidget ()));
    timer->start (1000);

    mythread = new MyThread ();
    mythread->start ();

    setLayout (layout1);
}
/**
 * update array with the received data
 */
void MutexKnobData::SetMutexKnobDataReceived(knobData *kData) {
    char units[40];
    char fec[40];
    char dataString[1024];
    double diff;
    struct timeb now;
    QMutexLocker locker(&mutex);
    int index = kData->index;
    memcpy(&KnobData[index].edata, &kData->edata, sizeof(epicsData));

    /*****************************************************************************************/
    // Statistics
    /*****************************************************************************************/

    nbMonitors++;

    // find monitor with highest count since last time
    if((kData->edata.monitorCount-kData->edata.monitorCountPrev) > highestCount) {
        highestCount = kData->edata.monitorCount -kData->edata.monitorCountPrev ;
        highestIndex = index;
    }

    // calculate after 5 seconds our statistics
    ftime(&now);
    diff = ((double) now.time + (double) now.millitm / (double)1000) -
            ((double) monitorTiming.time + (double) monitorTiming.millitm / (double)1000);

    if(diff >= 5.0) {
        ftime(&monitorTiming);
        nbMonitorsPerSecond = (int) (nbMonitors/diff);
        nbMonitors = 0;
        // remember monitor count for all monitors
        for(int i=0; i < GetMutexKnobDataSize(); i++) {
            knobData *kPtr = (knobData*) &KnobData[i];
            if(kPtr->index != -1) kPtr->edata.monitorCountPrev = kPtr->edata.monitorCount;
        }

        highestCountPerSecond = highestCount / diff;
        highestIndexPV = highestIndex;
        highestCount = 0;
        nbDisplayCountPerSecond =  (int) (displayCount/diff);
        displayCount = 0;
    }

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

    // direct update without timing

    if(myUpdateType == UpdateDirect) {
        QWidget *dispW = (QWidget*) kData->dispW;
        dataString[0] = '\0';
        strcpy(units, kData->edata.units);
        strcpy(fec, kData->edata.fec);
        int caFieldType= kData->edata.fieldtype;

        if((caFieldType == DBF_STRING || caFieldType == DBF_ENUM || caFieldType == DBF_CHAR) && kData->edata.dataB != (void*) 0) {
            if(kData->edata.dataSize < 1024) {
                memcpy(dataString, (char*) kData->edata.dataB, kData->edata.dataSize);
                dataString[kData->edata.dataSize] = '\0';
            }
        }

        kData->edata.displayCount = kData->edata.monitorCount;
        locker.unlock();
        UpdateWidget(index, dispW, units, fec, dataString, KnobData[index]);
        kData->edata.lastTime = now;
        kData->edata.initialize = false;
        displayCount++;
    }
}
Exemplo n.º 19
0
WidgetNormal* DialogNewEdit::Response()
{
	UpdateWidget();
	return widgetNormal;
}
/**
  * timer is running with 50 ms speed
  */
void MutexKnobData::timerEvent(QTimerEvent *)
{
    double diff, repRate;
    char units[40];
    char fec[40];
    char dataString[1024];
    struct timeb now;

    if(blockProcess) return;

    ftime(&now);

    //qDebug() << "============================================";
    for(int i=0; i < GetMutexKnobDataSize(); i++) {
        knobData *kPtr = (knobData*) &KnobData[i];

        if(kPtr->index != -1) {
            diff = ((double) now.time + (double) now.millitm / (double)1000) -
                    ((double) kPtr->edata.lastTime.time + (double) kPtr->edata.lastTime.millitm / (double)1000);
            if(kPtr->edata.repRate < 1) repRate = 1;
            else repRate = kPtr->edata.repRate;
        }

        // update all graphical items for this soft pv when a value changes
        if(kPtr->index != -1 && kPtr->soft && (diff >= (1.0/(double)repRate))) {
            int indx;
            //qDebug() << "I am a soft channel" << kPtr->pv << kPtr->dispName << kPtr->edata.rvalue << kPtr->index;
            // get for this soft pv the index of the corresponding caCalc into the knobData array where the data were updated
            if(getSoftPV(kPtr->pv, &indx, (QWidget*) kPtr->thisW)) {
                // get value from (updated) QMap variable list
                knobData *ptr = (knobData*) &KnobData[indx];
                kPtr->edata.rvalue = ptr->edata.rvalue;
                kPtr->edata.fieldtype = caDOUBLE;
                kPtr->edata.connected = true;
                kPtr->edata.accessW = true;
                kPtr->edata.accessR = true;
                //increase monitor count when value has changed
                if(kPtr->edata.oldsoftvalue != ptr->edata.rvalue) {
                    //qDebug() << kPtr->pv << kPtr->dispName << "will be updated with value=" << ptr->edata.rvalue << "from" << ptr->pv << "index=" << ptr->index << "oldvalue=" << kPtr->edata.oldsoftvalue;
                    kPtr->edata.monitorCount++;
                }

                // when any monitors for calculation increase monitorcount
                QWidget *w1 =  (QWidget*) kPtr->dispW;
                QVariant var = w1->property("MonitorList");
                QVariantList list = var.toList();
                if(list.size() > 0) {
                    int nbMonitors = list.at(0).toInt();
                    if(nbMonitors > 0) {
                        kPtr->edata.monitorCount++;
                    }
                }

                kPtr->edata.oldsoftvalue = ptr->edata.rvalue;
                QWidget *ww = (QWidget *)kPtr->dispW;
                if (caTextEntry *widget = qobject_cast<caTextEntry *>(ww)) {
                    widget->setAccessW(kPtr->edata.accessW);
                }
            }
        }

        // use specified repetition rate (normally 5Hz)
        if( ((kPtr->index != -1) && (kPtr->edata.monitorCount > kPtr->edata.displayCount) && (diff >= (1.0/(double)repRate)))){
            /*
            printf("<%s> index=%d mcount=%d dcount=%d value=%f datasize=%d valuecount=%d\n", kPtr->pv, kPtr->index, kPtr->edata.monitorCount,
                                                                      kPtr->edata.displayCount, kPtr->edata.rvalue,
                                                                      kPtr->edata.dataSize, kPtr->edata.valueCount);
*/
            if((myUpdateType == UpdateTimed) || kPtr->soft) {
                QMutexLocker locker(&mutex);
                int index = kPtr->index;
                QWidget *dispW = (QWidget*) kPtr->dispW;
                dataString[0] = '\0';
                strcpy(units, kPtr->edata.units);
                strcpy(fec, kPtr->edata.fec);
                int caFieldType= kPtr->edata.fieldtype;

                if((caFieldType == DBF_STRING || caFieldType == DBF_ENUM || caFieldType == DBF_CHAR) && kPtr->edata.dataB != (void*) 0) {
                    if(kPtr->edata.dataSize < 1024) {
                        memcpy(dataString, (char*) kPtr->edata.dataB, kPtr->edata.dataSize);
                        dataString[kPtr->edata.dataSize] = '\0';
                    } else {
                        memcpy(dataString, (char*) kPtr->edata.dataB, 1024);
                        dataString[1023] = '\0';
                    }
                }

                kPtr->edata.displayCount = kPtr->edata.monitorCount;
                locker.unlock();
                UpdateWidget(index, dispW, units, fec, dataString, KnobData[index]);
                kPtr->edata.lastTime = now;
                kPtr->edata.initialize = false;
                displayCount++;
            }

        } else if ((kPtr->index != -1)  && (diff >= (1.0/(double)repRate))) {
            if( (!kPtr->edata.connected)) {
                QMutexLocker locker(&mutex);
                bool displayIt = false;
                units[0] = '\0';
                fec[0] = '\0';
                dataString[0] = '\0';
                int index = kPtr->index;
                // brake unconnected displays
                if(kPtr->edata.unconnectCount == 0) {
                    kPtr->edata.displayCount = kPtr->edata.monitorCount;
                    kPtr->edata.lastTime = now;
                    displayIt = true;
                }
                kPtr->edata.unconnectCount++;
                if(kPtr->edata.unconnectCount == 10) kPtr->edata.unconnectCount=0;
                locker.unlock();
                if(displayIt) UpdateWidget(index, (QWidget*) kPtr->dispW, units, fec, dataString, KnobData[index]);
            }
        }
    }
}