Beispiel #1
0
/////////////////////////////////////////////////////////////////////////////
// set up some stuff
/////////////////////////////////////////////////////////////////////////////
void CChatControl::PreSubclassWindow() 
{
	CRichEditCtrl::PreSubclassWindow();

	//initialize
	initControl();	
}
/* Creates a panel control */
control* createPanel(int x, int y, int width, int height) {
    control* panel = NULL;
    panel = initControl(ctrl_panel,x,y,width,height);
    if (panel != NULL) {
        panel->drawControl = &drawContainer;
    }
    return panel;
}
NodeControl::NodeControl(NodeGraphDisplay *parent_, APoint graph_pos, Node *node_)
	: GuiElement(parent_, graph_pos, AVec(), GuiProps(STATE_FLAGS, PROP_FLAGS)),
		MovableElement(STATE_FLAGS),
		ParentElement(),
		ngd_parent(dynamic_cast<NodeGraphDisplay*>(parent_)), node(node_)
{
	//Initialize connectors
	for(unsigned int i = 0; i < toIndex(NCType::COUNT); i++)
		connectorControls[i] = nullptr;

	initControl();
}
  void CursynthGui::placeControl(std::string name, const Control* control,
                                 int x, int y, int width) {
    DisplayDetails* details = initControl(name, control);
    details->x = x;
    details->y = y;
    details->width = width;
    details->label = name;
    details->bipolar = control->isBipolar();

    details_lookup_[control] = details;
    drawControl(control, false);
  }
CharacterCreator_CareerBeliefPage::CharacterCreator_CareerBeliefPage(QWidget *parent)
    : QWizardPage(parent)
{
    _ui = new Ui::CharacterCreator_CareerBeliefPage();
    _ui->setupUi(this);

    QVBoxLayout* layout = new QVBoxLayout(this);
    CharacterCreator_LeftGuidesWidget* leftWidget = new CharacterCreator_LeftGuidesWidget(this);
    leftWidget->setCurrentPage(CAREER_BELIEF_PAGE);
    layout->addWidget(leftWidget);

    initControl();
}
Beispiel #6
0
	/// @brief Initialization from parameters.
	/// @param param a parameter object
	void init(const Opm::parameter::ParameterGroup& param)
	{
	    initControl(param);
	    initGridAndProps(param);
	    initInitialConditions(param);
	    initBoundaryConditions(param);
            initSources(param);
	    initSolvers(param);

	    // Write any unused parameters.
	    std::cout << "====================   Unused parameters:   ====================\n";
	    param.displayUsage();
	    std::cout << "================================================================\n";
	}
Beispiel #7
0
int main() {
	struct cntrl *p;
	char *query, *reply;

	p = initControl();
	
	while(1) {
		printf(PROMPT);
		query = GetString();
		if(!strncmp(query, "exit", 4)) break;
		if(query[0]!='\0') {
			reply = sendMessage(p,query);
			printf(reply);
		}
	}
}
Beispiel #8
0
// this is executed continuously
void appBase::run() {
  float idletime;
  uint32_t thisLoop;

  // delay loop to force update on even looptime boundaries
  while ( millis() < nextLoop ) { // delay until time for next loop
    if( /* lcd != NULL && */ buttons != NULL ) // check for button press
      checkInput();
    checkSerial(); // Has a command been received?
  }

  thisLoop = millis(); // actual time marker for this loop
  // time stamp = system time, seconds, for this set of samples
  timestamp = 0.001 * float( thisLoop ) - reftime;
  getSamples(); // retrieve values from MCP9800 and MCP3424
  if( first ) { // use first set of samples for RoR base values only
    first = false;
    initControl();
  }
  else {
    logSamples(); // output results to serial port
    doControl(); // perform control operations, if required
  }

  // save values for RoR calculation in next loop
  for( int j = 0; j < _NCHAN; j++ ) {
   int k = chan.getChan( j );
   if( k != 0 ) {
     --k;
     flast[k] = ftemps[k];
     lasttimes[k] = ftimes[k];
   }
  }

  idletime = looptime - ( millis() - thisLoop );
  // complain if we don't have some time left
  if (idletime < _IDLE_TIME_ALARM ) {
    Serial.print("# idle: ");
    Serial.println(idletime);
  }

  nextLoop += looptime; // time mark for start of next update
//  Serial.print("nextLoop="); Serial.print( nextLoop );
//  Serial.print("   looptime="); Serial.print( looptime );
//  Serial.println();
}
/* Creates a label control */
control* createLabel(int x, int y, int width, int height, const char* img_path) {
    control* label = NULL;
    SDL_Surface *img = NULL;
    label = initControl(ctrl_label,x,y,width,height);
    if (label != NULL) {
        img = IMG_Load(img_path);
        if (img == NULL) {
            printf("ERROR: failed to load image: %s\n", IMG_GetError());
            free(label);
            label = NULL;
        }
        else {
            label->surface = img;
            label->drawControl = &drawComponent;
        }
    }
    return label;
}
/* Creates a GUI window control */
control* createWindow(int width, int height, const char* title) {
    control* window = NULL;
    SDL_Surface *w = NULL;
    window = initControl(ctrl_window,0,0,width,height);
    if (window != NULL) {
        w  = SDL_SetVideoMode(width, height, 0, SDL_HWSURFACE | SDL_DOUBLEBUF);
        if (w == NULL) {
            printf("ERROR: failed to set video mode: %s\n", SDL_GetError());
            free(window);
            window = NULL;
        }
        else {
            SDL_WM_SetCaption(title, title);
            window->surface = w;
            window->drawControl = &drawWindow;
        }
    }
    return window;
}
Beispiel #11
0
NAMESPACE_EDITOR_BEGIN

//-----------------------------------//

ResourcesPage::ResourcesPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size )
	: wxTreeCtrl(parent, id, pos, size, wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT)
{
	ResourceManager* res = GetResourceManager();
	
	res->onResourcePrepared.Connect( this, &ResourcesPage::onResourcePrepared );
	res->onResourceRemoved.Connect( this, &ResourcesPage::onResourceRemoved );
	
	res->onResourceLoaded.Connect( this, &ResourcesPage::onResourceReloaded );
	res->onResourceReloaded.Connect( this, &ResourcesPage::onResourceReloaded );

	initIcons();
	initControl();
	updateTree();
}
/* creates a button control */
control* createButton(int x, int y, int width, int height, const char* img_path, int (*func)(control*, control*, SDL_MouseButtonEvent)) {
    control* button = NULL;
    SDL_Surface *img = NULL;
    button = initControl(ctrl_button,x,y,width,height);
    if (button != NULL) {
        button->print = FALSE;
        img = IMG_Load(img_path);
        if (img == NULL) {
            printf("ERROR: failed to load image: %s\n", IMG_GetError());
            free(button);
            button = NULL;
        }
        else {
            button->surface = img;
            button->drawControl = &drawComponent;
            button->clickControl = func;
        }
    }
    return button;
}
int main(void)
{
	initControl();
	initLED1();
	initLED2();
	initLED3();
	initLED4();

	while(1)
		{
			turnOnLED2();
			if(switchControl() == GPIO_PIN_SET)
			{
				turnOnLED4();
				if(Ethernet_Init() == 1)
				{
					HAL_ETH_Start(&heth);
					blink_LED1();
				}
				turnOffLED4();
			}
		}
}
Beispiel #14
0
bool TimingTaskDlg::DlgProc(UINT message, WPARAM wParam,
	LPARAM lParam, LRESULT* lResult)
{
	HWND hWnd = m_hWnd;
	switch (message)
	{
	case WM_COMMAND:
	{
		int wmId, wmEvent;
		wmId = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// 分析菜单选择:
		switch (wmId)
		{
		case IDOK:
		{
			onBtnOk();
			break;
		}
		case ID_CancelTask:
		{
			resetState();
			break;
		}
		case IDCANCEL:
		{
			close();
			break;
		}
		case IDC_RADIO_FixTime:
		case IDC_RADIO_COUNTDOWN:
		case IDC_RADIO_RepeatYes:
		case IDC_RADIO_RepeatNo:
		{
			setHourState();
			break;
		}
		default:
			break;
		}
		break;
	}
	case WM_TIMER:
	{
		onTimer(message, wParam, lParam);
		break;
	}
	case WM_CLOSE:
	{
		close();
		*lResult = TRUE;
		return true;
	}
	case WM_INITDIALOG:
	{
		m_hRadioCountDown = GetDlgItem(m_hWnd, IDC_RADIO_COUNTDOWN);
		m_hRadioFixTime = GetDlgItem(m_hWnd, IDC_RADIO_FixTime);
		m_hEditHour = GetDlgItem(m_hWnd, IDC_EDIT_HOUR);
		m_hEditMin = GetDlgItem(m_hWnd, IDC_EDIT_MIN);
		m_hEditSec = GetDlgItem(m_hWnd, IDC_EDIT_SEC);		

		m_hRadioRepeatYes = GetDlgItem(m_hWnd, IDC_RADIO_RepeatYes);
		m_hRadioRepeatNo = GetDlgItem(m_hWnd, IDC_RADIO_RepeatNo);

		m_hEditBoxText = GetDlgItem(m_hWnd, IDC_EDIT_TaskBoxText);

		m_hStaRemainTime = GetDlgItem(m_hWnd, IDC_STATIC_RemainTime);
		m_hBtnCancelTask = GetDlgItem(m_hWnd, ID_CancelTask);

		m_hBtnOK = GetDlgItem(m_hWnd, IDOK);

		initControl();
		break;
	}
	default:
		break;
	}
	return __super::DlgProc(message, wParam, lParam, lResult);
}
Beispiel #15
0
int main() {
	int c1 = initControl(8587830272);
	int c2 = initControl(8587830276);
	int o1;
	int o2;
	int o3;
	int o4;
	int o5;
	int lcd = initLCD();
	int read1;
	int read2;
	int vidas1 = 3;
	int vidas2 = 3;
	int dir = 3;
	int i = 0;
	Point *p1;
	Point *p2;
	Point *p3;
	Dimension *dim1;
	Dimension *dim2;
	Dimension *dim3;

	o4 = createObject(lcd, 4, 0, 0);
	o1 = createObject(lcd, 1, 60, 0);
	o2 = createObject(lcd, 2, 250, 0);
	o3 = createObject(lcd, 3, 0, 0);
	

	dim1 = getDimensions(lcd,o1);
	dim2 = getDimensions(lcd,o2);
	dim3 = getDimensions(lcd,o3);
	setPosition(lcd,o1,60,130-dim1->height);
	setPosition(lcd,o2,250,130-dim2->height);

	while(1) {
		read1 = readControl(c1);
		read2 = readControl(c2);
		if(read1 == 0 || read1 == 4) {
			move(lcd, o1, read1);
		}
		if(read2 == 0 || read2 == 4) {
			move(lcd, o2, read2);
		}
		

		move(lcd, o3, dir);
		p3 = getPosition(lcd, o3);
		p1 = getPosition(lcd, o1);
		p2 = getPosition(lcd, o2);
		
		if(dir == 5 || dir == 7)
		{
			if(((p3->x >=((p1->x + dim1->width)-8)) && (p3->x < ((p1->x + dim1->width)+4))) && ((p3->y >= (p1->y -12)) && (p3->y < (p1->y +(dim1->height/2)))))
				dir = 1;
			if(((p3->x >=((p1->x + dim1->width)-8)) && (p3->x < ((p1->x + dim1->width)+4))) && ((p3->y >= (p1->y +(dim1->height/2))) && (p3->y < (p1->y + dim1->height + 8))))
				dir = 3;
			if (p3->x <= 0)
			{
				vidas1--;
				if(vidas1 == 0)
				{
					
					o5 = createObject(lcd, 5, 80, 110);
					break;
				}
				if(dir == 5)
					dir = 3;
				else
					dir = 1;
			}
			
		}
		else {
			//aqui es cuando dir == 3  || dir == 1
			if((((p3->x + dim3->width) < (p2->x + 8)) && ((p3->x + dim3->width) >= (p2->x - 4))) && ((p3->y >= (p2->y - 12)) && (p3->y < (p2->y +(dim2->height/2)))))
				dir = 7;
			if((((p3->x + dim3->width) < (p2->x + 8)) && ((p3->x + dim3->width) >= (p2->x - 4))) && ((p3->y >= (p2->y +(dim2->height/2))) && (p3->y < (p2->y + dim2->height + 8))))
				dir = 5;
			if((p3->x + dim3->width) >= 320)
			{
				vidas2--;
				if(vidas2 == 0)
				{
					o5 = createObject(lcd, 5, 80, 110);
					break;
				}
				if(dir == 3)
					dir = 5;
				else
					dir = 7;
			}
		}
		
		//Validar bordes superior e inferior
		if((p3->y + dim3->height) >= 240)
		{
			if(dir == 3)
				dir = 1;
			else 
				dir = 7; 
		}
		if(p3->y <= 0)
		{
			if(dir == 7)
				dir = 5;
			else
				dir = 3;
		}
		

		//printf("%u %u\n", p3->x, p3->y);
		//printf("%u %u\n", p2->x, p2->y);
	}

	stopLCD(lcd);

	return 0;
}